From: vsr Date: Mon, 9 Nov 2009 12:52:44 +0000 (+0000) Subject: 0020012: EDF 831 GEOM : API for points representation in 3D viewer X-Git-Tag: V5_1_3rc2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ad45bbceaf13d07652322432b7957ba09778e4db;p=modules%2Fgeom.git 0020012: EDF 831 GEOM : API for points representation in 3D viewer --- diff --git a/doc/salome/gui/GEOM/images/custom_point_marker.png b/doc/salome/gui/GEOM/images/custom_point_marker.png new file mode 100755 index 000000000..a71625ecd Binary files /dev/null and b/doc/salome/gui/GEOM/images/custom_point_marker.png differ diff --git a/doc/salome/gui/GEOM/images/dialog.png b/doc/salome/gui/GEOM/images/dialog.png index 53a2f41b5..19f374314 100755 Binary files a/doc/salome/gui/GEOM/images/dialog.png and b/doc/salome/gui/GEOM/images/dialog.png differ diff --git a/doc/salome/gui/GEOM/images/point_marker_dlg1.png b/doc/salome/gui/GEOM/images/point_marker_dlg1.png new file mode 100755 index 000000000..25ca798b7 Binary files /dev/null and b/doc/salome/gui/GEOM/images/point_marker_dlg1.png differ diff --git a/doc/salome/gui/GEOM/images/point_marker_dlg2.png b/doc/salome/gui/GEOM/images/point_marker_dlg2.png new file mode 100755 index 000000000..d0f7acef0 Binary files /dev/null and b/doc/salome/gui/GEOM/images/point_marker_dlg2.png differ diff --git a/doc/salome/gui/GEOM/images/std_point_marker.png b/doc/salome/gui/GEOM/images/std_point_marker.png new file mode 100755 index 000000000..ccf478b0c Binary files /dev/null and b/doc/salome/gui/GEOM/images/std_point_marker.png differ diff --git a/doc/salome/gui/GEOM/input/point_marker.doc b/doc/salome/gui/GEOM/input/point_marker.doc new file mode 100644 index 000000000..9fdca7c2c --- /dev/null +++ b/doc/salome/gui/GEOM/input/point_marker.doc @@ -0,0 +1,58 @@ +/*! + +\page point_marker_page Point Marker + +\n You can change the representation of the geometrical vertex +(vertices) in 3D viewer either by selecting one of the predefined +shapes or by loading the custom texture from an external file. + +- Standard point marker + +Geometry module provides a set of predefined point marker shapes which +can be used to display vertices in 3D viewer. +Each standard point marker has two attributes: type (defines shape +form) and scale factor (defines shape size). + +\image html point_marker_dlg1.png + +For the Python script a TUI Command: go.SetMarkerStd(Type, Size) +can be used. + +\image html std_point_marker.png + +- Custom point marker + +The user can also load the point marker shape from an external file. +This file should provide a description of the point texture as a set +of lines; each line is represented as sequence of "0" and "1" symbols, +where "1" symbol means an opaque pixel and "0" symbol means a +transparent pixel. The width of the texture correspond to the length +of the longest line in the file, expanded to the nearest byte-aligned +value. The height of the texture is equal to the number of non-empty +lines in the file. Note, that missing symbols are replaced by "0". + +Here is an example of such texture file: + +
+00111100
+00111100
+11111111
+11111111
+11111111
+11111111
+00111100
+00111100
+
+ +\image html point_marker_dlg2.png + +For the Python script a TUI Command: go.SetMarkerTexture(ID) +can be used. + +\image html custom_point_marker.png + +Our TUI Scripts provide you with useful examples of +\ref tui_point_marker "Setting Point Marker". + +*/ + diff --git a/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc index 743205b57..2573c0fa5 100644 --- a/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc @@ -61,4 +61,21 @@ gg.setColor(fuse_id,218,165,31) gg.setTransparency(fuse_id,0.5) \endcode -*/ \ No newline at end of file +\anchor tui_point_marker +

Set Point Marker

+ +\code +import salome +import geompy + +texture = geompy.LoadTexture("/users/user/mytexture.dat") + +v1 = geompy.MakeVertex(0, 0, 0) +v2 = geompy.MakeVertex(100, 0, 0) +v3 = geompy.MakeVertex(0, 100, 0) + +v1.SetMarkerStd(GEOM.MT_O_PLUS, GEOM.MS_25) +v2.SetMarkerStd(GEOM.MT_BALL, GEOM.MS_40) +v3.SetMarkerTexture(texture) +\endcode +*/ diff --git a/doc/salome/gui/GEOM/input/viewing_geom_obj.doc b/doc/salome/gui/GEOM/input/viewing_geom_obj.doc index 1c2a518d4..8012d2092 100644 --- a/doc/salome/gui/GEOM/input/viewing_geom_obj.doc +++ b/doc/salome/gui/GEOM/input/viewing_geom_obj.doc @@ -27,6 +27,8 @@ the standard Select Color menu. transparency of geometrical objects.
  • \subpage isolines_page "Isos" - allows to change the number of isolines displayed within a shape.
  • +
  • \subpage point_marker_page "Point Marker" - allows to change the +representation of geometrical vertex (vertices).
  • Auto color / Disable auto color - activates the auto color mode. When the auto color mode is enabled, the groups created on the sub-shapes of the selected geometrical object are automatically diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index 6911bf932..d4426ee6b 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -1384,7 +1384,7 @@ void AddObjectColors (int theDocID, case 13: aCommand += "GEOM.MS_70"; break; default: aCommand += "GEOM.MS_NONE"; break; } - aCommand += ");"; + aCommand += ")"; theScript += aCommand.ToCString(); } else if (aMarkerType == Aspect_TOM_USERDEFINED) { @@ -1393,7 +1393,7 @@ void AddObjectColors (int theDocID, TCollection_AsciiString aCommand( "\n\t" ); aCommand += aName + ".SetMarkerTexture(texture_map["; aCommand += aMarkerTextureID; - aCommand += "]);"; + aCommand += "])"; theScript += aCommand.ToCString(); } } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx index e15d307f5..719fd0a8e 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx @@ -358,6 +358,6 @@ void GEOMToolsGUI_MarkerDlg::help() { if ( getStudy() ) { SalomeApp_Application* app = qobject_cast( getStudy()->application() ); - app->onHelpContextModule( "GEOM", "point_marker.html" ); + app->onHelpContextModule( "GEOM", "point_marker_page.html" ); } } diff --git a/src/GEOM_SWIG/GEOM_example7.py b/src/GEOM_SWIG/GEOM_example7.py new file mode 100644 index 000000000..6cce391ef --- /dev/null +++ b/src/GEOM_SWIG/GEOM_example7.py @@ -0,0 +1,53 @@ +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# --- +# +# File : GEOM_example7.py +# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +# +# --- + +import salome +import geompy +import os +import GEOM + +data_dir = os.getenv('DATA_DIR') +if data_dir: + texture_1 = geompy.LoadTexture(os.path.join(data_dir, "Textures", "texture1.dat")) + texture_2 = geompy.LoadTexture(os.path.join(data_dir, "Textures", "texture2.dat")) + texture_3 = geompy.LoadTexture(os.path.join(data_dir, "Textures", "texture3.dat")) + + Vertex_1 = geompy.MakeVertex(0, 0, 0) + Vertex_2 = geompy.MakeVertex(100, 0, 0) + Vertex_3 = geompy.MakeVertex(0, 100, 0) + Vertex_4 = geompy.MakeVertex(0, 0, 100) + Vertex_5 = geompy.MakeVertex(100, 0, 100) + Vertex_1.SetMarkerTexture(texture_1); + Vertex_2.SetMarkerTexture(texture_2); + Vertex_3.SetMarkerTexture(texture_3); + Vertex_4.SetMarkerStd(GEOM.MT_O_PLUS, GEOM.MS_25); + Vertex_5.SetMarkerStd(GEOM.MT_BALL, GEOM.MS_40); + geompy.addToStudy( Vertex_1, "Vertex_1" ) + geompy.addToStudy( Vertex_2, "Vertex_2" ) + geompy.addToStudy( Vertex_3, "Vertex_3" ) + geompy.addToStudy( Vertex_4, "Vertex_4" ) + geompy.addToStudy( Vertex_5, "Vertex_5" ) + pass diff --git a/src/GEOM_SWIG/Makefile.am b/src/GEOM_SWIG/Makefile.am index 3b7c921fb..11862eb9a 100644 --- a/src/GEOM_SWIG/Makefile.am +++ b/src/GEOM_SWIG/Makefile.am @@ -48,6 +48,7 @@ dist_salomescript_DATA = \ GEOM_example4.py \ GEOM_example5.py \ GEOM_example6.py \ + GEOM_example7.py \ GEOM_moteur.py \ GEOM_TestAll.py \ GEOM_TestOthers.py \