+ // --------------------------------------------------------------------------
+ // Dimensions (Measurements) preferences
+ // --------------------------------------------------------------------------
+
+ int aDimGroupId = addPreference( tr( "PREF_DIMENSIONS" ), tabId );
+ setPreferenceProperty( aDimGroupId, "columns", 2 );
+
+ addPreference( tr( "PREF_DIMENSIONS_COLOR" ), aDimGroupId,
+ LightApp_Preferences::Color, "Geometry", "dimensions_color" );
+
+ int aDimLineWidthId = addPreference( tr( "PREF_DIMENSIONS_LINE_WIDTH" ), aDimGroupId,
+ LightApp_Preferences::IntSpin, "Geometry", "dimensions_line_width" );
+
+ setPreferenceProperty( aDimLineWidthId, "min", 1 );
+ setPreferenceProperty( aDimLineWidthId, "max", 5 );
+
+ int aDimFontId = addPreference( tr( "PREF_DIMENSIONS_FONT" ), aDimGroupId, LightApp_Preferences::Font, "Geometry", "dimensions_font" );
+
+ int f = QtxFontEdit::Family | QtxFontEdit::Size;
+ setPreferenceProperty( aDimFontId, "features", f );
+ setPreferenceProperty( aDimFontId, "mode", QtxFontEdit::Custom );
+
+ Handle(Font_FontMgr) fmgr = Font_FontMgr::GetInstance();
+ QString aFontFile = "";
+ resMgr->value("resources", "GEOM", aFontFile);
+ aFontFile = aFontFile + QDir::separator() + "Y14.5M-2009.ttf";
+ // add enginier font into combobox
+ /*int fontID =*/ QFontDatabase::addApplicationFont( aFontFile );
+ Handle(Font_SystemFont) sf = new Font_SystemFont(
+ new TCollection_HAsciiString("Y14.5M-2009"),
+ Font_FA_Regular,
+ new TCollection_HAsciiString(aFontFile.toLatin1().data()) );
+ // register font in OCC font manager
+ fmgr->RegisterFont( sf, Standard_False );
+
+ // get list of supported fonts by OCC
+ QStringList anOCCFonts;
+ TColStd_SequenceOfHAsciiString theFontsNames;
+ fmgr->GetAvailableFontsNames( theFontsNames );
+ for(Standard_Integer i=1; i<=theFontsNames.Length(); i++) {
+ Handle(TCollection_HAsciiString) str = theFontsNames(i);
+ anOCCFonts << str->ToCString();
+ }
+ anOCCFonts.removeDuplicates();
+ // set the supported fonts into combobox to use its only
+ setPreferenceProperty( aDimFontId, "fonts", anOCCFonts );
+
+ int aDimArrLengthId = addPreference( tr( "PREF_DIMENSIONS_ARROW_LENGTH" ), aDimGroupId,
+ LightApp_Preferences::DblSpin, "Geometry", "dimensions_arrow_length" );
+
+ setPreferenceProperty( aDimArrLengthId, "min", 1e-9 );
+ setPreferenceProperty( aDimArrLengthId, "max", 1e+9 );
+ setPreferenceProperty( aDimArrLengthId, "precision", 9 );
+
+ int aLengthUnitsId = addPreference( tr( "PREF_DIMENSIONS_LENGTH_UNITS" ), aDimGroupId,
+ LightApp_Preferences::Selector, "Geometry", "dimensions_length_units" );
+
+ int anAngUnitsId = addPreference( tr( "PREF_DIMENSIONS_ANGLE_UNITS" ), aDimGroupId,
+ LightApp_Preferences::Selector, "Geometry", "dimensions_angle_units" );
+
+ QStringList aListOfLengthUnits;
+ aListOfLengthUnits << "m";
+ aListOfLengthUnits << "cm";
+ aListOfLengthUnits << "mm";
+ aListOfLengthUnits << "in.";
+ aListOfLengthUnits << "ft.";
+
+ QStringList aListOfAngUnits;
+ aListOfAngUnits << "rad";
+ aListOfAngUnits << "deg";
+
+ setPreferenceProperty( aLengthUnitsId, "strings", aListOfLengthUnits );
+ setPreferenceProperty( anAngUnitsId, "strings", aListOfAngUnits );
+
+ addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId,
+ LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" );
+
+ int aDimDefFlyout = addPreference( tr( "PREF_DIMENSIONS_DEFAULT_FLYOUT" ), aDimGroupId,
+ LightApp_Preferences::DblSpin, "Geometry", "dimensions_default_flyout" );
+
+ setPreferenceProperty( aDimDefFlyout, "min", 1e-9 );
+ setPreferenceProperty( aDimDefFlyout, "max", 1e+9 );
+ setPreferenceProperty( aDimDefFlyout, "precision", 9 );
+
+ addPreference( tr( "PREF_DIMENSIONS_USE_TEXT3D" ), aDimGroupId,
+ LightApp_Preferences::Bool, "Geometry", "dimensions_use_text3d" );
+
+ // --------------------------------------------------------------------------
+ // Shape annotation preferences
+ // --------------------------------------------------------------------------
+
+ const int aShapeAnnGroupId = addPreference( tr( "PREF_SHAPE_ANNOTATIONS" ), tabId );
+ setPreferenceProperty( aShapeAnnGroupId, "columns", 2 );
+
+ addPreference( tr( "PREF_SHAPE_ANNOTATIONS_FONT_COLOR" ), aShapeAnnGroupId, LightApp_Preferences::Color, "Geometry", "shape_annotation_font_color" );
+ addPreference( tr( "PREF_SHAPE_ANNOTATIONS_LINE_COLOR" ), aShapeAnnGroupId, LightApp_Preferences::Color, "Geometry", "shape_annotation_line_color" );
+ const int aShapeAnnFont =
+ addPreference( tr( "PREF_SHAPE_ANNOTATIONS_FONT" ), aShapeAnnGroupId, LightApp_Preferences::Font, "Geometry", "shape_annotation_font" );
+
+ int aShapeAnnFontFeatures = QtxFontEdit::Family | QtxFontEdit::Size | QtxFontEdit::Bold | QtxFontEdit::Italic;
+ setPreferenceProperty( aShapeAnnFont, "features", aShapeAnnFontFeatures );
+ setPreferenceProperty( aShapeAnnFont, "mode", QtxFontEdit::Custom );
+ setPreferenceProperty( aShapeAnnFont, "fonts", anOCCFonts );
+
+ const int aShapeAnnLineWidth =
+ addPreference( tr( "PREF_SHAPE_ANNOTATIONS_LINE_WIDTH" ), aShapeAnnGroupId, LightApp_Preferences::IntSpin, "Geometry", "shape_annotation_line_width" );
+
+ setPreferenceProperty( aShapeAnnLineWidth, "min", 1 );
+ setPreferenceProperty( aShapeAnnLineWidth, "max", 5 );
+
+ addPreference( tr( "PREF_SHAPE_ANNOTATIONS_AUTOHIDE" ), aShapeAnnGroupId, LightApp_Preferences::Bool, "Geometry", "shape_annotation_autohide" );
+
+ const int aShapeAnnLineStyle =
+ addPreference( tr( "PREF_SHAPE_ANNOTATIONS_LINE_STYLE" ), aShapeAnnGroupId, LightApp_Preferences::Selector, "Geometry", "shape_annotation_line_style" );
+
+ QStringList aLineStyleList;
+ aLineStyleList.append( tr("PREF_SHAPE_ANNOTATIONS_LINESTYLE_SOLID") );
+ aLineStyleList.append( tr("PREF_SHAPE_ANNOTATIONS_LINESTYLE_DASH") );
+ aLineStyleList.append( tr("PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOT") );
+ aLineStyleList.append( tr("PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOTDASH") );
+
+ QList<QVariant> aLineStyleIds;
+ aLineStyleIds.append(0);
+ aLineStyleIds.append(1);
+ aLineStyleIds.append(2);
+ aLineStyleIds.append(3);
+
+ setPreferenceProperty( aShapeAnnLineStyle, "strings", aLineStyleList );
+ setPreferenceProperty( aShapeAnnLineStyle, "indexes", aLineStyleIds );
+
+ // --------------------------------------------------------------------------
+ // Isoline drawing preferences
+ // --------------------------------------------------------------------------
+