0020012: EDF 831 GEOM : API for points representation in 3D viewer

This commit is contained in:
vsr 2009-11-09 12:52:44 +00:00
parent 6453f00ff2
commit ad45bbceaf
12 changed files with 135 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -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 <b>TUI Command:</b> <em>go.SetMarkerStd(Type, Size)</em>
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:
<pre>
00111100
00111100
11111111
11111111
11111111
11111111
00111100
00111100
</pre>
\image html point_marker_dlg2.png
For the Python script a <b>TUI Command:</b> <em>go.SetMarkerTexture(ID)</em>
can be used.
\image html custom_point_marker.png
Our <b>TUI Scripts</b> provide you with useful examples of
\ref tui_point_marker "Setting Point Marker".
*/

View File

@ -61,4 +61,21 @@ gg.setColor(fuse_id,218,165,31)
gg.setTransparency(fuse_id,0.5)
\endcode
*/
\anchor tui_point_marker
<br><h2>Set Point Marker</h2>
\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
*/

View File

@ -27,6 +27,8 @@ the standard <b>Select Color</b> menu.</li>
transparency of geometrical objects.</li>
<li>\subpage isolines_page "Isos" - allows to change the number of
isolines displayed within a shape.</li>
<li>\subpage point_marker_page "Point Marker" - allows to change the
representation of geometrical vertex (vertices).</li>
<li><b>Auto color</b> / <b>Disable auto color</b> - 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

View File

@ -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();
}
}

View File

@ -358,6 +358,6 @@ void GEOMToolsGUI_MarkerDlg::help()
{
if ( getStudy() ) {
SalomeApp_Application* app = qobject_cast<SalomeApp_Application*>( getStudy()->application() );
app->onHelpContextModule( "GEOM", "point_marker.html" );
app->onHelpContextModule( "GEOM", "point_marker_page.html" );
}
}

View File

@ -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

View File

@ -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 \