uipolygonSelectWindowButtonUp

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - User interface
Introduced first in SolidGeometry 4.4, Creation date: 2018-12-27, Last change: 2025-09-14

MAIN CALLBACK FUNCT for a figure to make polygons movable if rotate3d is off

Description

The concepts works as follows if rotate3d is off (mandatory):
This callback function uipolygonSelectWindowButtonUp is the Mouse Button Up function and
- deselects all polygons in the current figure BY CLICKING SOMEWHERE WHERE THERE IS NO POLYGON
- select all polygons in the current figure BY DOUBLE CLICKING NEAR POLYGONS
Selecting a polygon means:
1. show the selected mode; points a marked
2. Attach the function uipolygonmoveWindowButtonDownFcn as Mouse Button Down function to those polygons
3. A UIContextMenu is attached inside the function uipolygonmoveWindowButtonDownFcn to polygons
Deselecting a polygon means:
1. show the unselected mode; no points are marked
2. Remove the function uipolygonmoveWindowButtonDownFcn as Mouse Button Down function of those polygons
3. Still have the UIContextMenu existing
HOW TO USE THESE FUNCTIONS
Just add this function as Button up function to a figure window AFTER deselecting rotate3d
rotate3d off; set(gcf,'WindowButtonUpFcn',@uipolygonSelectWindowButtonUp)
Now, it is possible to select and move polygons.
FUTURE:
a) This concept could be extended to CPLs and CVL and SG
b) the UIContextMenu could be extended to modify the shape by stretching/shrinking a polygon
c) the UIContextMenu could be extended to add or remove points of a polygon
d) the UIContextMenu could be extended to move points of a polygon

See Also: uipolygoncontextmenu , uipolygonmoveWindowButtonDownFcn

Example Illustration

 missing image of uipolygonSelectWindowButtonUp(srch,cbdat)

Syntax

uipolygonSelectWindowButtonUp(srch,cbdat)

Input Parameter

srch: source handle - not used yet
cbdat: call back data - not used yet

Examples


SGfigure; hold on; plot(polyshape(PLcircle(10,4))); plot(polyshape(PLcircle(10,8)+20));
rotate3d off; set(gcf,'WindowButtonUpFcn',@uipolygonSelectWindowButtonUp) % Now double click works




Copyright 2018-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Last html export of this page out of FM database by TL: 2025-09-21