From: nds Date: Tue, 27 Aug 2019 05:26:23 +0000 (+0300) Subject: 0030922: Visualization - OpenGl_Text wrong local transformation if text has not own... X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=3d2b7d38f70ef90cee8a817c8efd4d3cd590db6c;p=occt.git 0030922: Visualization - OpenGl_Text wrong local transformation if text has not own attach point (cherry picked from commit d149bbcbaf7d237425b574a1977acb07db299bea) (cherry picked from commit 95a4927b5b2b9310de6ebe36f0fe6523cebe52c6) (cherry picked from commit f414985732fb8084363d543e65fc4d7232e22488) --- diff --git a/src/AIS/AIS_TextLabel.cxx b/src/AIS/AIS_TextLabel.cxx index 76fb8f1c33..ca0322c02f 100644 --- a/src/AIS/AIS_TextLabel.cxx +++ b/src/AIS/AIS_TextLabel.cxx @@ -39,10 +39,19 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_TextLabel,AIS_InteractiveObject) //purpose : //======================================================================= AIS_TextLabel::AIS_TextLabel() +<<<<<<< HEAD : myText ("?"), myHasOrientation3D (Standard_False), myHasOwnAnchorPoint (Standard_True), myHasFlipping (Standard_False) +======= +: myText ("?"), + myFont ("Courier"), + myFontAspect (Font_FA_Regular), + myHasOrientation3D (Standard_False), + myHasOwnAnchorPoint (Standard_True), + myHasFlipping (Standard_False) +>>>>>>> 05ac0c7d75 (0030922: Visualization - OpenGl_Text wrong local transformation if text has not own attach point) { myDrawer->SetTextAspect (new Prs3d_TextAspect()); myDrawer->SetDisplayMode (0); @@ -304,6 +313,7 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager)& , } gp_Ax2 anOrientation = myOrientation3D; anOrientation.SetLocation (aPosition); +<<<<<<< HEAD Standard_Boolean aHasOwnAnchor = HasOwnAnchorPoint(); if (myHasFlipping) { @@ -312,6 +322,14 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager)& , Handle(Graphic3d_Text) aText = Prs3d_Text::Draw (thePrs->CurrentGroup(), anAsp, myText, anOrientation, aHasOwnAnchor); aText->SetTextFormatter (myFormatter); +======= + + Standard_Boolean aHasOwnAnchor = HasOwnAnchorPoint(); + if (myHasFlipping) + aHasOwnAnchor = Standard_False; // always not using own anchor if flipping + + Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePrs), anAsp, myText, myOrientation3D, aHasOwnAnchor); +>>>>>>> 05ac0c7d75 (0030922: Visualization - OpenGl_Text wrong local transformation if text has not own attach point) if (myHasFlipping && isInit) { thePrs->CurrentGroup()->SetFlippingOptions (Standard_False, gp_Ax2()); diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index 98ae2e622a..1f44755957 100644 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -2543,8 +2543,22 @@ static int VDrawText (Draw_Interpretor& theDI, const bool toFlip = Draw::ParseOnOffNoIterator (theArgsNb, theArgVec, anArgIt); aTextPrs->SetFlipping (toFlip); } +<<<<<<< HEAD else if (aParam == "-ownanchor" || aParam == "-noownanchor") +======= + else if (aParam == "-ownanchor") + { + if (++anArgIt >= theArgsNb) + { + std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n"; + return 1; + } + aTextPrs->SetOwnAnchorPoint (Draw::Atoi (theArgVec[anArgIt]) == 1); + } + else if (aParam == "-disptype" + || aParam == "-displaytype") +>>>>>>> 05ac0c7d75 (0030922: Visualization - OpenGl_Text wrong local transformation if text has not own attach point) { const bool isOwnAnchor = Draw::ParseOnOffNoIterator (theArgsNb, theArgVec, anArgIt); aTextPrs->SetOwnAnchorPoint (isOwnAnchor); @@ -6784,6 +6798,7 @@ static int VNormals (Draw_Interpretor& theDI, void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands) { +<<<<<<< HEAD const char* aGroup = "AIS Viewer"; const char* aFileName = __FILE__; auto addCmd = [&](const char* theName, Draw_Interpretor::CommandFunction theFunc, const char* theHelp) @@ -7109,6 +7124,294 @@ Creates and displays a sphere. addCmd ("vobjzlayer", VObjZLayer, /* [vobjzlayer] */ R"( vobjzlayer : set/get object [layerid] - set or get z layer id for the interactive object )" /* [vobjzlayer] */); +======= + const char *group ="AISObjects"; + + theCommands.Add ("vtrihedron", + "vtrihedron : vtrihedron name" + "\n\t\t: [-dispMode {wireframe|shading} ]" + "\n\t\t: [-origin x y z ]" + "\n\t\t: [-zaxis u v w -xaxis u v w ]" + "\n\t\t: [-drawAxes {X|Y|Z|XY|YZ|XZ|XYZ}]" + "\n\t\t: [-hideLabels {on|off}]" + "\n\t\t: [-hideArrows {on|off}]" + "\n\t\t: [-label {XAxis|YAxis|ZAxis} value]" + "\n\t\t: [-attribute {XAxisLength|YAxisLength|ZAxisLength" + "\n\t\t: |TubeRadiusPercent|ConeRadiusPercent" + "\n\t\t: |ConeLengthPercent|OriginRadiusPercent" + "\n\t\t: |ShadingNumberOfFacettes} value]" + "\n\t\t: [-color {Origin|XAxis|YAxis|ZAxis|XOYAxis|YOZAxis" + "\n\t\t: |XOZAxis|Whole} {r g b | colorName}]" + "\n\t\t: [-textColor {r g b | colorName}]" + "\n\t\t: [-arrowColor {r g b | colorName}]" + "\n\t\t: [-priority {Origin|XAxis|YAxis|ZAxis|XArrow" + "\n\t\t: |YArrow|ZArrow|XOYAxis|YOZAxis" + "\n\t\t: |XOZAxis|Whole} value]" + "\n\t\t:" + "\n\t\t: Creates a new *AIS_Trihedron* object or changes parameters of " + "\n\t\t: existing trihedron. If no argument is set," + "\n\t\t: the default trihedron (0XYZ) is created." + "\n\t\t: -dispMode mode of visualization: wf - wireframe," + "\n\t\t: sh - shading." + "\n\t\t: Default value is wireframe." + "\n\t\t: -origin allows to set trihedron location." + "\n\t\t: -zaxis/-xaxis allows to set trihedron X and Z" + "\n\t\t: directions. The directions should" + "\n\t\t: be orthogonal. Y direction is calculated." + "\n\t\t: -drawAxes allows to set what axes are drawn in the" + "\n\t\t: trihedron, default state is XYZ" + "\n\t\t: -hideLabels allows to show/hide trihedron labels" + "\n\t\t: -hideArrows allows to show/hide trihedron arrows" + "\n\t\t: -label allows to change default X/Y/Z titles of axes" + "\n\t\t: -attribute sets parameters of trihedron" + "\n\t\t: -color sets color properties of parts of trihedron" + "\n\t\t: -textColor sets color properties of trihedron labels" + "\n\t\t: -arrowColor sets color properties of trihedron arrows" + "\n\t\t: -priority allows to change default selection priority" + "\n\t\t: of trihedron components", + __FILE__,VTrihedron,group); + + theCommands.Add("vtri2d", + "vtri2d Name" + "\n\t\t: Creates a plane with a 2D trihedron from an interactively selected face.", + __FILE__,VTrihedron2D ,group); + + theCommands.Add("vplanetri", + "vplanetri name" + "\n\t\t: Create a plane from a trihedron selection. If no arguments are set, the default", + __FILE__,VPlaneTrihedron ,group); + + theCommands.Add("vsize", + "vsize : vsize [name(Default=Current)] [size(Default=100)] " + "\n\t\t: Changes the size of a named or selected trihedron." + "\n\t\t: If the name is not defined: it affects the selected trihedrons otherwise nothing is done." + "\n\t\t: If the value is not defined: it is set to 100 by default.", + __FILE__,VSize,group); + + theCommands.Add("vaxis", + "vaxis name [Xa] [Ya] [Za] [Xb] [Yb] [Zb]" + "\n\t\t: Creates an axis. If the values are not defined, an axis is created by interactive selection of two vertices or one edge", + __FILE__,VAxisBuilder,group); + + theCommands.Add("vaxispara", + "vaxispara name " + "\n\t\t: Creates an axis by interactive selection of an edge and a vertex.", + __FILE__,VAxisBuilder,group); + + theCommands.Add("vaxisortho", + "vaxisortho name " + "\n\t\t: Creates an axis by interactive selection of an edge and a vertex. The axis will be orthogonal to the selected edge.", + __FILE__,VAxisBuilder,group); + + theCommands.Add("vpoint", + "vpoint PointName [Xa] [Ya] [Za] " + "\n\t\t: Creates a point from coordinates. If the values are not defined," + "\n\t\t: a point is created by interactive selection of a vertice or an edge (in the center of the edge).", + __FILE__,VPointBuilder,group); + + theCommands.Add("vplane", + "vplane PlaneName [AxisName/PlaneName/PointName] [PointName/PointName/PointName] [Nothing/Nothing/PointName] [TypeOfSensitivity {0|1}]" + "\n\t\t: Creates a plane from named or interactively selected entities." + "\n\t\t: TypeOfSensitivity:" + "\n\t\t: 0 - Interior" + "\n\t\t: 1 - Boundary", + __FILE__,VPlaneBuilder,group); + + theCommands.Add ("vchangeplane", "vchangeplane usage: \n" + " vchangeplane " + " [x=center_x y=center_y z=center_z]" + " [dx=dir_x dy=dir_y dz=dir_z]" + " [sx=size_x sy=size_y]" + " [noupdate]\n" + " - changes parameters of the plane:\n" + " - x y z - center\n" + " - dx dy dz - normal\n" + " - sx sy - plane sizes\n" + " - noupdate - do not update/redisplay the plane in context\n" + " Please enter coordinates in format \"param=value\" in arbitrary order.", + __FILE__, VChangePlane, group); + + theCommands.Add("vplanepara", + "vplanepara PlaneName " + "\n\t\t: Creates a plane from interactively selected vertex and face.", + __FILE__,VPlaneBuilder,group); + + theCommands.Add("vplaneortho", + "vplaneortho PlaneName " + "\n\t\t: Creates a plane from interactive selected face and coplanar edge. ", + __FILE__,VPlaneBuilder,group); + + theCommands.Add("vline", + "vline LineName [Xa/PointName] [Ya/PointName] [Za] [Xb] [Yb] [Zb] " + "\n\t\t: Creates a line from coordinates, named or interactively selected vertices. ", + __FILE__,VLineBuilder,group); + + theCommands.Add("vcircle", + "vcircle CircleName [PointName PointName PointName IsFilled]\n\t\t\t\t\t[PlaneName PointName Radius IsFilled]" + "\n\t\t: Creates a circle from named or interactively selected entities." + "\n\t\t: Parameter IsFilled is defined as 0 or 1.", + __FILE__,VCircleBuilder,group); + + theCommands.Add ("vdrawtext", + "vdrawtext name text" + "\n\t\t: [-pos X=0 Y=0 Z=0]" + "\n\t\t: [-color {R G B|name}=yellow]" + "\n\t\t: [-halign {left|center|right}=left]" + "\n\t\t: [-valign {top|center|bottom|topfirstline}=bottom}]" + "\n\t\t: [-angle angle=0]" + "\n\t\t: [-zoom {0|1}=0]" + "\n\t\t: [-height height=16]" + "\n\t\t: [-aspect {regular|bold|italic|boldItalic}=regular]" + "\n\t\t: [-font font=Times]" + "\n\t\t: [-2d]" + "\n\t\t: [-perspos {X Y Z}=0 0 0], where" + "\n\t\t X and Y define the coordinate origin in 2d space relative to the view window" + "\n\t\t Example: X=0 Y=0 is center, X=1 Y=1 is upper right corner etc..." + "\n\t\t Z coordinate defines the gap from border of view window (except center position)." + "\n\t\t: [-disptype {blend|decal|shadow|subtitle|dimension|normal}=normal}" + "\n\t\t: [-subcolor {R G B|name}=white]" + "\n\t\t: [-noupdate]" + "\n\t\t: [-plane NormX NormY NormZ DirX DirY DirZ]" + "\n\t\t: [-flipping]" + "\n\t\t: [-ownanchor {0|1}=1]" + "\n\t\t: Display text label at specified position.", + __FILE__, VDrawText, group); + + theCommands.Add("vdrawsphere", + "vdrawsphere: vdrawsphere shapeName Fineness [X=0.0 Y=0.0 Z=0.0] [Radius=100.0] [ToShowEdges=0] [ToPrintInfo=1]\n", + __FILE__,VDrawSphere,group); + + theCommands.Add ("vlocation", + "vlocation name" + "\n\t\t: [-reset]" + "\n\t\t: [-copyFrom otherName]" + "\n\t\t: [-translate X Y [Z]]" + "\n\t\t: [-rotate x y z dx dy dz angle]" + "\n\t\t: [-scale [X Y Z] scale]" + "\n\t\t: [-mirror x y z dx dy dz]" + "\n\t\t: [-setLocation X Y [Z]]" + "\n\t\t: [-setRotation QX QY QZ QW]" + "\n\t\t: [-setScale [X Y Z] scale]" + "\n\t\t: [-inheritParentTrsf {on|off}]" + "\n\t\t: Object local transformation management:" + "\n\t\t: -reset reset transformation to identity" + "\n\t\t: -translate translate object" + "\n\t\t: -rotate applies rotation to local transformation" + "\n\t\t: -scale applies scale to local transformation" + "\n\t\t: -mirror applies mirror to local transformation" + "\n\t\t: -setLocation assign object location" + "\n\t\t: -setRotation assign object rotation (quaternion)" + "\n\t\t: -setScale assign object scale factor" + "\n\t\t: -inheritParentTrsf option to inherit parent" + "\n\t\t: transformation or not (ON by default)", + __FILE__, VSetLocation, group); + theCommands.Add ("vsetlocation", + "alias for vlocation", + __FILE__, VSetLocation, group); + theCommands.Add ("vchild", + "vchild parent [-add] [-remove] [-ignoreParentTrsf {0|1}] child1 [child2] [...]" + "\n\t\t: Command for testing low-level presentation connections." + "\n\t\t: vconnect command should be used instead.", + __FILE__, VChild, group); + theCommands.Add("vparent", + "vparent parent [-ignoreVisu]" + "\n\t\t: Command for testing object properties as parent in the hierarchy." + "\n\t\t: Arguments:" + "\n\t\t: -ignoreVisu do not propagate the visual state (display/erase/color) to children objects", + __FILE__, VParent, group); + theCommands.Add ("vcomputehlr", + "vcomputehlr shapeInput hlrResult [-algoType {algo|polyAlgo}=polyAlgo]" + "\n\t\t: [eyeX eyeY eyeZ dirX dirY dirZ upX upY upZ]" + "\n\t\t: [-showTangentEdges {on|off}=off] [-nbIsolines N=0] [-showHiddenEdges {on|off}=off]" + "\n\t\t: Arguments:" + "\n\t\t: shapeInput - name of the initial shape" + "\n\t\t: hlrResult - result HLR object from initial shape" + "\n\t\t: eye, dir are eye position and look direction" + "\n\t\t: up is the look up direction vector" + "\n\t\t: -algoType HLR algorithm to use" + "\n\t\t: -showTangentEdges include tangent edges" + "\n\t\t: -nbIsolines include isolines" + "\n\t\t: -showHiddenEdges include hidden edges" + "\n\t\t: Use vtop to see projected HLR shape.", + __FILE__, VComputeHLR, group); + + theCommands.Add("vdrawparray", + "vdrawparray name TypeOfArray={points|segments|polylines|triangles" + "\n\t\t: |trianglefans|trianglestrips|quads|quadstrips|polygons}" + "\n\t\t: [-deinterleaved|-mutable]" + "\n\t\t: [vertex={'v' x y z [normal={'n' nx ny nz}] [color={'c' r g b}] [texel={'t' tx ty}]]" + "\n\t\t: [bound= {'b' nbVertices [bound_color={'c' r g b}]]" + "\n\t\t: [edge= {'e' vertexId]" + "\n\t\t: [-shape shapeName] [-patch]" + "\n\t\t: Commands create an Interactive Object for specified Primitive Array definition (Graphic3d_ArrayOfPrimitives)" + "\n\t\t: with the main purpose is covering various combinations by tests", + __FILE__,VDrawPArray,group); + + theCommands.Add("vconnect", + "vconnect name Xo Yo Zo object1 object2 ... [color=NAME]" + "\n\t\t: Creates and displays AIS_ConnectedInteractive object from input object and location.", + __FILE__, VConnect, group); + + theCommands.Add("vconnectto", + "vconnectto : instance_name Xo Yo Zo object [-nodisplay|-noupdate|-update]" + " Makes an instance 'instance_name' of 'object' with position (Xo Yo Zo)." + "\n\t\t: -nodisplay - only creates interactive object, but not displays it", + __FILE__, VConnectTo,group); + + theCommands.Add("vdisconnect", + "vdisconnect assembly_name (object_name | object_number | 'all')" + " Disconnects all objects from assembly or disconnects object by name or number (use vlistconnected to enumerate assembly children).", + __FILE__,VDisconnect,group); + + theCommands.Add("vaddconnected", + "vaddconnected assembly_name object_name" + "Adds object to assembly.", + __FILE__,VAddConnected,group); + + theCommands.Add("vlistconnected", + "vlistconnected assembly_name" + "Lists objects in assembly.", + __FILE__,VListConnected,group); + + + theCommands.Add("vselmode", + "vselmode [object] selectionMode {on|off}" + "\n\t\t: [{-add|-set|-globalOrLocal}=-globalOrLocal]" + "\n\t\t: Switches selection mode for the specified object or for all objects in context." + "\n\t\t: Selection mode is either an integer number specific to Interactive Object," + "\n\t\t: or sub-shape type in case of AIS_Shape:" + "\n\t\t: Shape, Vertex, Edge, Wire, Face, Shell, Solid, CompSolid, Compound" + "\n\t\t: The integer mode 0 (Shape in case of AIS_Shape) is reserved for selecting object as whole." + "\n\t\t: Additional options:" + "\n\t\t: -add already activated selection modes will be left activated" + "\n\t\t: -set already activated selection modes will be deactivated" + "\n\t\t: -globalOrLocal (default) if new mode is Global selection mode," + "\n\t\t: then active local selection modes will be deactivated" + "\n\t\t: and the samthen active local selection modes will be deactivated", + __FILE__, VSetSelectionMode, group); + + theCommands.Add("vselnext", + "vselnext : hilight next detected", + __FILE__, VSelectionNext, group); + + theCommands.Add("vselprev", + "vselnext : hilight previous detected", + __FILE__, VSelectionPrevious, group); + + theCommands.Add("vtriangle", + "vtriangle Name PointName PointName PointName" + "\n\t\t: Creates and displays a filled triangle from named points.", + __FILE__, VTriangle,group); + + theCommands.Add("vsegment", + "vsegment Name PointName PointName" + "\n\t\t: Creates and displays a segment from named points.", + __FILE__, VTriangle,group); + + theCommands.Add("vobjzlayer", + "vobjzlayer : set/get object [layerid] - set or get z layer id for the interactive object", + __FILE__, VObjZLayer, group); +>>>>>>> 05ac0c7d75 (0030922: Visualization - OpenGl_Text wrong local transformation if text has not own attach point) addCmd ("vpolygonoffset", VPolygonOffset, /* [vpolygonoffset] */ R"( vpolygonoffset [object [mode factor units]]