0027731: Visualization, OpenGl_AspectMarker - handle fractional marker Scale when...
authorkgv <kgv@opencascade.com>
Mon, 1 Aug 2016 14:15:52 +0000 (17:15 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 4 Aug 2016 08:45:38 +0000 (11:45 +0300)
OpenGl_AspectMarker::Resources::SpriteKeys() now encodes decimal number of marker scale into resource key,
since built-in markers are defined with 0.5 scale step.

samples/tcl/markers.tcl
src/OpenGl/OpenGl_AspectMarker.cxx

index b2d44b5..af18729 100644 (file)
@@ -31,7 +31,8 @@ set aCustom2 [locate_data_file images/marker_box2.png]
 set aCustom3 [locate_data_file images/marker_kr.png]
 set aCustom4 [locate_data_file images/marker_dot.png]
 
 set aCustom3 [locate_data_file images/marker_kr.png]
 set aCustom4 [locate_data_file images/marker_dot.png]
 
-set aFontFile [locate_data_file DejaVuSans.ttf]
+set aFontFile ""
+catch { set aFontFile [locate_data_file DejaVuSans.ttf] }
 set aLabelFont "Arial"
 if { "$aFontFile" != "" } {
   vfont add "$aFontFile" SansFont
 set aLabelFont "Arial"
 if { "$aFontFile" != "" } {
   vfont add "$aFontFile" SansFont
@@ -55,7 +56,8 @@ for { set aMarkerType 0 } { $aMarkerType <= 13 } { incr aMarkerType } {
   set aRow [expr $aMarkerType - 7]
   set aCol 5
   set aName [lindex $aMarkerTypeNames $aMarkerType]
   set aRow [expr $aMarkerType - 7]
   set aCol 5
   set aName [lindex $aMarkerTypeNames $aMarkerType]
-  vdrawtext "$aName" "$aName" -pos 0 [expr $aRow + 0.5] 0 -color 0.5 1.0 1.0 -halign center -valign center -angle 000 -zoom 0 -height 12 -aspect bold -font $aLabelFont
+  vdrawtext "$aName" "$aName" -pos 0 [expr $aRow + 0.5] 0 -color 0.5 1.0 1.0 -halign center -valign center -angle 000 -zoom 0 -height 12 -aspect bold -font $aLabelFont -noupdate
+  vdisplay -top -noupdate "$aName"
   if { $aMarkerType == 13 } {
     vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom1
     set aCol [expr $aCol - 1]
   if { $aMarkerType == 13 } {
     vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom1
     set aCol [expr $aCol - 1]
index 047eb09..f90ced0 100644 (file)
@@ -1950,8 +1950,8 @@ void OpenGl_AspectMarker::Resources::SpriteKeys (const Handle(Graphic3d_MarkerIm
   }
   else if (theType != Aspect_TOM_POINT)
   {
   }
   else if (theType != Aspect_TOM_POINT)
   {
-    // predefined markers
-    const Standard_Integer aScale = Standard_Integer(theScale + 0.5f);
+    // predefined markers are defined with 0.5 step
+    const Standard_Integer aScale = Standard_Integer(theScale * 10.0f + 0.5f);
     theKey  = TCollection_AsciiString ("OpenGl_AspectMarker") + theType + "_" + aScale;
     theKeyA = theKey + "A";
     if (theType == Aspect_TOM_BALL)
     theKey  = TCollection_AsciiString ("OpenGl_AspectMarker") + theType + "_" + aScale;
     theKeyA = theKey + "A";
     if (theType == Aspect_TOM_BALL)