Draft: use MarkerSize for snap and tracker markers

This commit is contained in:
Roy-043
2023-12-08 21:14:03 +01:00
parent 32a0e0c6ae
commit a6cd89f746
2 changed files with 20 additions and 10 deletions

View File

@@ -547,10 +547,14 @@ class Edit(gui_base_original.Modifier):
def resetTrackersBezier(self, obj):
# in future move tracker definition to DraftTrackers
knotmarkers = (coin.SoMarkerSet.DIAMOND_FILLED_9_9,#sharp
coin.SoMarkerSet.SQUARE_FILLED_9_9, #tangent
coin.SoMarkerSet.HOURGLASS_FILLED_9_9) #symmetric
polemarker = coin.SoMarkerSet.CIRCLE_FILLED_9_9 #pole
param = App.ParamGet("User parameter:BaseApp/Preferences/View")
size = param.GetInt("MarkerSize", 9)
knotmarkers = (
Gui.getMarkerIndex("DIAMOND_FILLED", size), # sharp
Gui.getMarkerIndex("SQUARE_FILLED", size), # tangent
Gui.getMarkerIndex("HOURGLASS_FILLED", size) # symmetric
)
polemarker = Gui.getMarkerIndex("CIRCLE_FILLED", size) # pole
self.trackers[obj.Name] = []
cont = obj.Continuity
firstknotcont = cont[-1] if (obj.Closed and cont) else 0

View File

@@ -162,7 +162,8 @@ class snapTracker(Tracker):
def __init__(self):
self.marker = coin.SoMarkerSet() # this is the marker symbol
self.marker.markerIndex = FreeCADGui.getMarkerIndex("", 9)
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View")
self.marker.markerIndex = FreeCADGui.getMarkerIndex("CIRCLE_FILLED", param.GetInt("MarkerSize", 9))
self.coords = coin.SoCoordinate3() # this is the coordinate
self.coords.point.setValue((0, 0, 0))
node = coin.SoAnnotation()
@@ -173,7 +174,8 @@ class snapTracker(Tracker):
def setMarker(self, style):
"""Set the marker index."""
self.marker.markerIndex = FreeCADGui.getMarkerIndex(style, 9)
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View")
self.marker.markerIndex = FreeCADGui.getMarkerIndex(style, param.GetInt("MarkerSize", 9))
def setColor(self, color=None):
"""Set the color."""
@@ -697,7 +699,8 @@ class ghostTracker(Tracker):
self.coords = coin.SoCoordinate3()
self.coords.point.setValue((obj.X, obj.Y, obj.Z))
self.marker = coin.SoMarkerSet() # this is the marker symbol
self.marker.markerIndex = FreeCADGui.getMarkerIndex("quad", 9)
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View")
self.marker.markerIndex = FreeCADGui.getMarkerIndex("SQUARE_FILLED", param.GetInt("MarkerSize", 9))
node = coin.SoAnnotation()
selnode = coin.SoSeparator()
selnode.addChild(self.coords)
@@ -833,10 +836,13 @@ class editTracker(Tracker):
"""A node edit tracker."""
def __init__(self, pos=Vector(0, 0, 0), name=None, idx=0, objcol=None,
marker=FreeCADGui.getMarkerIndex("quad", 9),
inactive=False):
marker=None, inactive=False):
self.marker = coin.SoMarkerSet() # this is the marker symbol
self.marker.markerIndex = marker
if marker is None:
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View")
self.marker.markerIndex = FreeCADGui.getMarkerIndex("SQUARE_FILLED", param.GetInt("MarkerSize", 9))
else:
self.marker.markerIndex = marker
self.coords = coin.SoCoordinate3() # this is the coordinate
self.coords.point.setValue((pos.x, pos.y, pos.z))
self.position = pos