1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025974: Visualization - fix misprints in method naming of Graphic3d_GraduatedTrihedron

V3d_View::GetGraduatedTrihedron() - return configuration structure directly.

OpenGl_View::TriedronDisplay() - do not re-create trihedron on each Display call.
OpenGl_Trihedron::Setup() - eliminate global variables.
OpenGl_PrimitiveArray::buildVBO() - release old VBOs before initialization.

ViewerTest.hxx - move out package header from .cdl file.
ViewerTest::ParseColor() - add new method to parse color arguments in common way.

vzbufftrihedron - improve command syntax.
vgraduatedtrihedron - add options -drawgrid and -drawaxes.
This commit is contained in:
kgv
2015-04-03 21:41:52 +03:00
committed by bugmaster
parent 24e40cc2dc
commit 536d98e224
27 changed files with 918 additions and 599 deletions

View File

@@ -10,3 +10,5 @@ ViewerTest_FilletCommands.cxx
ViewerTest_VoxelCommands.cxx
ViewerTest_OpenGlCommands.cxx
ViewerTest_ViewerCommands_1.mm
ViewerTest.hxx
ViewerTest.cxx

View File

@@ -42,156 +42,4 @@ is
MapTransientHasher from TColStd,
AsciiString from TCollection);
-- ----------------------------------------------------------------------
-- Package methods
-- ----------------------------------------------------------------------
Factory (theDI : out Interpretor from Draw);
---Purpose: Loads all Draw commands of V2d & V3d. Used for plugin.
---Category: Create the viewer....
ViewerInit ( thePxLeft, thePxTop : Integer from Standard = 0;
thePxWidth, thePxHeight : Integer from Standard = 0;
theViewName : CString from Standard = "";
theDisplayName : CString from Standard = "")
returns AsciiString from TCollection;
---Purpose: Creates view with default or custom name
-- and add this name in map to manage muliple views
-- implemented in ViewerTest_ViewerCommands.cxx
---Category: Manage the name of views
RemoveViewName (theName: AsciiString from TCollection);
InitViewName (theName: AsciiString from TCollection;
theView: View from V3d);
GetCurrentViewName returns AsciiString from TCollection;
---Category: Delete the viewer....
RemoveView (theViewName : AsciiString from TCollection;
theToRemoveContext : Boolean from Standard = Standard_True);
---Purpose: Removes view and clear all maps
-- with information about its resources if neccessary
---Category: Delete the viewer....
RemoveView (theView : View from V3d;
theToRemoveContext : Boolean from Standard = Standard_True);
---Purpose: Removes view and clear all maps
-- with information about its resources if neccessary
---Category: Selection in the viewer....
WClass returns TShared from MMgt is private;
---C++: return const &
---Purpose: Returns a window class that implements standard behavior of
-- all windows of the ViewerTest. This includes usual Open CASCADE
-- view conventions for mouse buttons (e.g. Ctrl+MB1 for zoom,
-- Ctrl+MB2 for pan, etc) and keyboard shortcuts.
-- This method is relevant for MS Windows only and respectively
-- returns WNT_WClass handle.
PickShape (aType : ShapeEnum from TopAbs;
MaxPick : Integer from Standard = 5) returns Shape from TopoDS;
---Purpose: waits until a shape of type <aType> is picked in the AIS Viewer and returns it.
-- if <aType> == TopAbs_Shape, any shape can be picked...
-- MaxPick is the Max number before exiting, if no pick is successfull
PickShapes (aType : ShapeEnum from TopAbs;
thepicked : in out HArray1OfShape from TopTools;
MaxPick : Integer from Standard = 5)
returns Boolean from Standard;
---Purpose: wait until the array is filled with picked shapes.
-- returns True if the array is filled.
-- exit if number of unsuccesfull picks = <MaxPick>
PickObject(Type : KindOfInteractive from AIS = AIS_KOI_None;
Signature : Integer from Standard = -1;
MaxPick : Integer from Standard = 5)
returns InteractiveObject from AIS;
---Purpose: waits until an interactive object of a given Type
-- and signature is picked (defaut values authorize
-- selection of any Interactive Object)
-- exit if number of unsuccesfull picks = <MaxPick>
PickObjects(thepicked : in out HArray1OfTransient from TColStd;
Type : KindOfInteractive from AIS = AIS_KOI_None;
Signature : Integer from Standard = -1;
MaxPick : Integer from Standard = 5)
returns Boolean from Standard;
---Purpose: selection of several interactive objects. Number is given
-- by the size of <thepicked>
-- exit if number of unsuccesfull picks = <MaxPick>
Commands (theCommands : in out Interpretor from Draw);
AviCommands(theCommands :in out Interpretor from Draw);
ViewerCommands(theCommands :in out Interpretor from Draw);
MyCommands (theCommands : in out Interpretor from Draw); -- My Own Com-s
RelationCommands(theCommands :in out Interpretor from Draw);
ObjectCommands(theCommands :in out Interpretor from Draw);
FilletCommands(theCommands :in out Interpretor from Draw);
VoxelCommands(theCommands :in out Interpretor from Draw);
OpenGlCommands(theCommands :in out Interpretor from Draw);
GetMousePosition(xpix,ypix: out Integer from Standard);
GetViewerFromContext returns Viewer from V3d;
GetCollectorFromContext returns Viewer from V3d;
GetAISContext returns InteractiveContext from AIS;
---C++: return const &
GetNISContext returns InteractiveContext from NIS;
---C++: return &
SetAISContext (aContext: InteractiveContext from AIS);
SetNISContext (aContext: InteractiveContext from NIS);
CurrentView returns View from V3d;
---C++: return const &
CurrentView (aViou:View from V3d);
Clear ;
---Category: Change behaviour on move,select,... events.
SetEventManager (aMgr:EventManager from ViewerTest);
---Purpose: puts <aMgr> as current eventmanager (the
-- move,select,...will be applied to <aMgr>
UnsetEventManager;
---Purpose: removes the last EventManager from the list.
ResetEventManager;
---Purpose: clear the list of EventManagers and
-- sets the default EventManager as current
CurrentEventManager returns EventManager from ViewerTest;
---Category: privateMethods...
RemoveSelected;
StandardModeActivation(Mode : Integer from Standard);
GetColorFromName(name: CString from Standard)
returns NameOfColor from Quantity;
RedrawAllViews;
---Purpose: redraws all defined views.
SplitParameter (theString : AsciiString from TCollection;
theName : out AsciiString from TCollection;
theValue : out AsciiString from TCollection)
returns Boolean from Standard;
---Purpose: Splits "parameter=value" string into separate
-- parameter and value strings.
-- @return TRUE if the string matches pattern "<string>=<empty or string>"
end;

View File

@@ -106,6 +106,56 @@ Quantity_NameOfColor ViewerTest::GetColorFromName (const Standard_CString theNam
return aColor;
}
//=======================================================================
//function : ParseColor
//purpose :
//=======================================================================
Standard_Integer ViewerTest::ParseColor (Standard_Integer theArgNb,
const char** theArgVec,
Quantity_Color& theColor)
{
Quantity_NameOfColor aColor = Quantity_NOC_BLACK;
if (theArgNb >= 1
&& Quantity_Color::ColorFromName (theArgVec[0], aColor))
{
theColor = aColor;
return 1;
}
else if (theArgNb >= 3)
{
const TCollection_AsciiString anRgbStr[3] =
{
theArgVec[0],
theArgVec[1],
theArgVec[2]
};
if (!anRgbStr[0].IsRealValue()
|| !anRgbStr[1].IsRealValue()
|| !anRgbStr[2].IsRealValue())
{
return 0;
}
Graphic3d_Vec4d anRgb;
anRgb.x() = anRgbStr[0].RealValue();
anRgb.y() = anRgbStr[1].RealValue();
anRgb.z() = anRgbStr[2].RealValue();
if (anRgb.x() < 0.0 || anRgb.x() > 1.0
|| anRgb.y() < 0.0 || anRgb.y() > 1.0
|| anRgb.z() < 0.0 || anRgb.z() > 1.0)
{
std::cout << "Error: RGB color values should be within range 0..1!\n";
return 0;
}
theColor.SetValues (anRgb.x(), anRgb.y(), anRgb.z(), Quantity_TOC_RGB);
return 3;
}
return 0;
}
//=======================================================================
//function : GetTypeNames
//purpose :

View File

@@ -0,0 +1,212 @@
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ViewerTest_HeaderFile
#define _ViewerTest_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
#include <Draw_Interpretor.hxx>
#include <Standard_Integer.hxx>
#include <Standard_CString.hxx>
#include <Handle_V3d_View.hxx>
#include <Standard_Boolean.hxx>
#include <Handle_MMgt_TShared.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <Handle_TopTools_HArray1OfShape.hxx>
#include <Handle_AIS_InteractiveObject.hxx>
#include <AIS_KindOfInteractive.hxx>
#include <Handle_TColStd_HArray1OfTransient.hxx>
#include <Handle_V3d_Viewer.hxx>
#include <Handle_AIS_InteractiveContext.hxx>
#include <NIS_InteractiveContext.hxx>
#include <Handle_ViewerTest_EventManager.hxx>
#include <Quantity_NameOfColor.hxx>
class TCollection_AsciiString;
class V3d_View;
class MMgt_TShared;
class TopoDS_Shape;
class TopTools_HArray1OfShape;
class AIS_InteractiveObject;
class TColStd_HArray1OfTransient;
class V3d_Viewer;
class AIS_InteractiveContext;
class ViewerTest_EventManager;
class ViewerTest_EventManager;
class ViewerTest_DoubleMapOfInteractiveAndName;
class ViewerTest_DoubleMapNodeOfDoubleMapOfInteractiveAndName;
class ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName;
class Quantity_Color;
class ViewerTest
{
public:
DEFINE_STANDARD_ALLOC
//! Loads all Draw commands of V2d & V3d. Used for plugin.
Standard_EXPORT static void Factory (Draw_Interpretor& theDI);
//! Creates view with default or custom name
//! and add this name in map to manage muliple views
//! implemented in ViewerTest_ViewerCommands.cxx
Standard_EXPORT static TCollection_AsciiString ViewerInit (const Standard_Integer thePxLeft = 0,
const Standard_Integer thePxTop = 0,
const Standard_Integer thePxWidth = 0,
const Standard_Integer thePxHeight = 0,
const Standard_CString theViewName = "",
const Standard_CString theDisplayName = "");
Standard_EXPORT static void RemoveViewName (const TCollection_AsciiString& theName);
Standard_EXPORT static void InitViewName (const TCollection_AsciiString& theName,
const Handle(V3d_View)& theView);
Standard_EXPORT static TCollection_AsciiString GetCurrentViewName();
//! Removes view and clear all maps
//! with information about its resources if necessary
Standard_EXPORT static void RemoveView (const TCollection_AsciiString& theViewName,
const Standard_Boolean theToRemoveContext = Standard_True);
//! Removes view and clear all maps
//! with information about its resources if necessary
Standard_EXPORT static void RemoveView (const Handle(V3d_View)& theView,
const Standard_Boolean theToRemoveContext = Standard_True);
//! waits until a shape of type <aType> is picked in the AIS Viewer and returns it.
//! if <aType> == TopAbs_Shape, any shape can be picked...
//! MaxPick is the Max number before exiting, if no pick is successful
Standard_EXPORT static TopoDS_Shape PickShape (const TopAbs_ShapeEnum aType,
const Standard_Integer MaxPick = 5);
//! wait until the array is filled with picked shapes.
//! returns True if the array is filled.
//! exit if number of unsuccessful picks = <MaxPick>
Standard_EXPORT static Standard_Boolean PickShapes (const TopAbs_ShapeEnum aType,
Handle(TopTools_HArray1OfShape)& thepicked,
const Standard_Integer MaxPick = 5);
//! waits until an interactive object of a given Type
//! and signature is picked (default values authorize
//! selection of any Interactive Object)
//! exit if number of unsuccessful picks = <MaxPick>
Standard_EXPORT static Handle(AIS_InteractiveObject) PickObject (const AIS_KindOfInteractive Type = AIS_KOI_None,
const Standard_Integer Signature = -1,
const Standard_Integer MaxPick = 5);
//! selection of several interactive objects.
//! Number is given by the size of <thepicked>
//! exit if number of unsuccesfull picks = <MaxPick>
Standard_EXPORT static Standard_Boolean PickObjects (Handle(TColStd_HArray1OfTransient)& thepicked,
const AIS_KindOfInteractive Type = AIS_KOI_None,
const Standard_Integer Signature = -1,
const Standard_Integer MaxPick = 5);
Standard_EXPORT static void Commands (Draw_Interpretor& theCommands);
Standard_EXPORT static void AviCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void ViewerCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void MyCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void RelationCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void ObjectCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void FilletCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void VoxelCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void OpenGlCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void GetMousePosition (Standard_Integer& xpix, Standard_Integer& ypix);
Standard_EXPORT static Handle(V3d_Viewer) GetViewerFromContext();
Standard_EXPORT static Handle(V3d_Viewer) GetCollectorFromContext();
Standard_EXPORT static const Handle(AIS_InteractiveContext)& GetAISContext();
Standard_EXPORT static NIS_InteractiveContext& GetNISContext();
Standard_EXPORT static void SetAISContext (const Handle(AIS_InteractiveContext)& aContext);
Standard_EXPORT static void SetNISContext (const NIS_InteractiveContext& aContext);
Standard_EXPORT static const Handle(V3d_View)& CurrentView();
Standard_EXPORT static void CurrentView (const Handle(V3d_View)& aViou);
Standard_EXPORT static void Clear();
//! puts theMgr as current eventmanager (the move,select,...will be applied to theMgr)
Standard_EXPORT static void SetEventManager (const Handle(ViewerTest_EventManager)& theMgr);
//! removes the last EventManager from the list.
Standard_EXPORT static void UnsetEventManager();
//! clear the list of EventManagers and
//! sets the default EventManager as current
Standard_EXPORT static void ResetEventManager();
Standard_EXPORT static Handle(ViewerTest_EventManager) CurrentEventManager();
Standard_EXPORT static void RemoveSelected();
Standard_EXPORT static void StandardModeActivation (const Standard_Integer Mode);
Standard_EXPORT static Quantity_NameOfColor GetColorFromName (const Standard_CString name);
//! Parses color argument(s) specified within theArgVec[0], theArgVec[1] and theArgVec[2].
//! Handles either color specified by name (single argument)
//! or by RGB components (3 arguments) in range 0..1.
//! The result is stored in theColor on success.
//! Returns number of handled arguments (1 or 3) or 0 on syntax error.
Standard_EXPORT static Standard_Integer ParseColor (Standard_Integer theArgNb,
const char** theArgVec,
Quantity_Color& theColor);
//! redraws all defined views.
Standard_EXPORT static void RedrawAllViews();
//! Splits "parameter=value" string into separate
//! parameter and value strings.
//! @return TRUE if the string matches pattern "<string>=<empty or string>"
Standard_EXPORT static Standard_Boolean SplitParameter (const TCollection_AsciiString& theString,
TCollection_AsciiString& theName,
TCollection_AsciiString& theValue);
private:
//! Returns a window class that implements standard behavior of
//! all windows of the ViewerTest. This includes usual Open CASCADE
//! view conventions for mouse buttons (e.g. Ctrl+MB1 for zoom,
//! Ctrl+MB2 for pan, etc) and keyboard shortcuts.
//! This method is relevant for MS Windows only and respectively
//! returns WNT_WClass handle.
Standard_EXPORT static const Handle(MMgt_TShared)& WClass();
friend class ViewerTest_EventManager;
friend class ViewerTest_DoubleMapOfInteractiveAndName;
friend class ViewerTest_DoubleMapNodeOfDoubleMapOfInteractiveAndName;
friend class ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName;
};
#endif // _ViewerTest_HeaderFile

View File

@@ -2857,94 +2857,228 @@ static int VScale(Draw_Interpretor& di, Standard_Integer argc, const char** argv
return 0;
}
//==============================================================================
//function : VTestZBuffTrihedron
//purpose : Displays a V3d_ZBUFFER'ed or V3d_WIREFRAME'd trihedron
//function : VZBuffTrihedron
//purpose :
//==============================================================================
static int VTestZBuffTrihedron(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/,
Standard_Integer theArgNb,
const char** theArgVec)
{
Handle(V3d_View) V3dView = ViewerTest::CurrentView();
if ( V3dView.IsNull() ) return 1;
V3dView->ZBufferTriedronSetup();
if ( argc == 1 ) {
// Set up default trihedron parameters
V3dView->TriedronDisplay( Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.1, V3d_ZBUFFER );
} else
if ( argc == 7 )
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
Aspect_TypeOfTriedronPosition aPosition = Aspect_TOTP_LEFT_LOWER;
const char* aPosType = argv[1];
if ( strcmp(aPosType, "center") == 0 )
{
aPosition = Aspect_TOTP_CENTER;
} else
if (strcmp(aPosType, "left_lower") == 0)
{
aPosition = Aspect_TOTP_LEFT_LOWER;
} else
if (strcmp(aPosType, "left_upper") == 0)
{
aPosition = Aspect_TOTP_LEFT_UPPER;
} else
if (strcmp(aPosType, "right_lower") == 0)
{
aPosition = Aspect_TOTP_RIGHT_LOWER;
} else
if (strcmp(aPosType, "right_upper") == 0)
{
aPosition = Aspect_TOTP_RIGHT_UPPER;
} else
{
di << argv[1] << " Invalid type of alignment" << "\n";
di << "Must be one of [ center, left_lower," << "\n";
di << "left_upper, right_lower, right_upper ]" << "\n";
return 1;
}
Standard_Real R = Draw::Atof(argv[2])/255.;
Standard_Real G = Draw::Atof(argv[3])/255.;
Standard_Real B = Draw::Atof(argv[4])/255.;
Quantity_Color aColor(R, G, B, Quantity_TOC_RGB);
Standard_Real aScale = Draw::Atof(argv[5]);
if( aScale <= 0.0 )
{
di << argv[5] << " Invalid value. Must be > 0" << "\n";
return 1;
}
V3d_TypeOfVisualization aPresentation = V3d_ZBUFFER;
const char* aPresType = argv[6];
if ( strcmp(aPresType, "wireframe") == 0 )
{
aPresentation = V3d_WIREFRAME;
} else
if (strcmp(aPresType, "zbuffer") == 0)
{
aPresentation = V3d_ZBUFFER;
} else
{
di << argv[6] << " Invalid type of visualization" << "\n";
di << "Must be one of [ wireframe, zbuffer ]" << "\n";
return 1;
}
V3dView->TriedronDisplay( aPosition, aColor.Name(), aScale, aPresentation );
} else
{
di << argv[0] << " Invalid number of arguments" << "\n";
std::cout << "Error: no active viewer!\n";
return 1;
}
V3dView->View()->ZFitAll();
V3dView->Redraw();
ViewerTest_AutoUpdater anUpdateTool (ViewerTest::GetAISContext(), aView);
Aspect_TypeOfTriedronPosition aPosition = Aspect_TOTP_LEFT_LOWER;
V3d_TypeOfVisualization aVisType = V3d_ZBUFFER;
Quantity_Color aLabelsColor = Quantity_NOC_WHITE;
Quantity_Color anArrowColorX = Quantity_NOC_RED;
Quantity_Color anArrowColorY = Quantity_NOC_GREEN;
Quantity_Color anArrowColorZ = Quantity_NOC_BLUE1;
Standard_Real aScale = 0.1;
Standard_Real aSizeRatio = 0.8;
Standard_Real anArrowDiam = 0.05;
Standard_Integer aNbFacets = 12;
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
Standard_CString anArg = theArgVec[anArgIter];
TCollection_AsciiString aFlag (anArg);
aFlag.LowerCase();
if (anUpdateTool.parseRedrawMode (aFlag))
{
continue;
}
else if (aFlag == "-on")
{
continue;
}
else if (aFlag == "-off")
{
aView->TriedronErase();
return 0;
}
else if (aFlag == "-pos"
|| aFlag == "-position"
|| aFlag == "-corner")
{
if (++anArgIter >= theArgNb)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
TCollection_AsciiString aPosName (theArgVec[anArgIter]);
aPosName.LowerCase();
if (aPosName == "center")
{
aPosition = Aspect_TOTP_CENTER;
}
else if (aPosName == "left_lower"
|| aPosName == "lower_left"
|| aPosName == "leftlower"
|| aPosName == "lowerleft")
{
aPosition = Aspect_TOTP_LEFT_LOWER;
}
else if (aPosName == "left_upper"
|| aPosName == "upper_left"
|| aPosName == "leftupper"
|| aPosName == "upperleft")
{
aPosition = Aspect_TOTP_LEFT_UPPER;
}
else if (aPosName == "right_lower"
|| aPosName == "lower_right"
|| aPosName == "rightlower"
|| aPosName == "lowerright")
{
aPosition = Aspect_TOTP_RIGHT_LOWER;
}
else if (aPosName == "right_upper"
|| aPosName == "upper_right"
|| aPosName == "rightupper"
|| aPosName == "upperright")
{
aPosition = Aspect_TOTP_RIGHT_UPPER;
}
else
{
std::cerr << "Error: wrong syntax at '" << anArg << "' - unknown position '" << aPosName << "'\n";
return 1;
}
}
else if (aFlag == "-type")
{
if (++anArgIter >= theArgNb)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
TCollection_AsciiString aTypeName (theArgVec[anArgIter]);
aTypeName.LowerCase();
if (aTypeName == "wireframe"
|| aTypeName == "wire")
{
aVisType = V3d_WIREFRAME;
}
else if (aTypeName == "zbuffer"
|| aTypeName == "shaded")
{
aVisType = V3d_ZBUFFER;
}
else
{
std::cerr << "Error: wrong syntax at '" << anArg << "' - unknown type '" << aTypeName << "'\n";
}
}
else if (aFlag == "-scale")
{
if (++anArgIter >= theArgNb)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
aScale = Draw::Atof (theArgVec[anArgIter]);
}
else if (aFlag == "-size"
|| aFlag == "-sizeratio")
{
if (++anArgIter >= theArgNb)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
aSizeRatio = Draw::Atof (theArgVec[anArgIter]);
}
else if (aFlag == "-arrowdiam"
|| aFlag == "-arrowdiameter")
{
if (++anArgIter >= theArgNb)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
anArrowDiam = Draw::Atof (theArgVec[anArgIter]);
}
else if (aFlag == "-nbfacets")
{
if (++anArgIter >= theArgNb)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
aNbFacets = Draw::Atoi (theArgVec[anArgIter]);
}
else if (aFlag == "-colorlabel"
|| aFlag == "-colorlabels")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aLabelsColor);
if (aNbParsed == 0)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
anArgIter += aNbParsed;
}
else if (aFlag == "-colorarrowx")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorX);
if (aNbParsed == 0)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
anArgIter += aNbParsed;
}
else if (aFlag == "-colorarrowy")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorY);
if (aNbParsed == 0)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
anArgIter += aNbParsed;
}
else if (aFlag == "-colorarrowz")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorZ);
if (aNbParsed == 0)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
anArgIter += aNbParsed;
}
else
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
}
aView->ZBufferTriedronSetup (anArrowColorX.Name(), anArrowColorY.Name(), anArrowColorZ.Name(),
aSizeRatio, anArrowDiam, aNbFacets);
aView->TriedronDisplay (aPosition, aLabelsColor.Name(), aScale, aVisType);
aView->View()->ZFitAll();
return 0;
}
@@ -3720,7 +3854,8 @@ static int VGraduatedTrihedron (Draw_Interpretor& /*theDi*/, Standard_Integer th
// On/off arguments
if ((aKey.IsEqual ("xdrawname") || aKey.IsEqual ("ydrawname") || aKey.IsEqual ("zdrawname")
|| aKey.IsEqual ("xdrawticks") || aKey.IsEqual ("ydrawticks") || aKey.IsEqual ("zdrawticks")
|| aKey.IsEqual ("xdrawvalues") || aKey.IsEqual ("ydrawvalues") || aKey.IsEqual ("zdrawvalues"))
|| aKey.IsEqual ("xdrawvalues") || aKey.IsEqual ("ydrawvalues") || aKey.IsEqual ("zdrawvalues")
|| aKey.IsEqual ("drawgrid") || aKey.IsEqual ("drawaxes"))
&& anArgs->Length() == 1 && (anArgs->Value(1).IsEqual ("on") || anArgs->Value(1).IsEqual ("off")))
{
continue;
@@ -3799,15 +3934,15 @@ static int VGraduatedTrihedron (Draw_Interpretor& /*theDi*/, Standard_Integer th
}
if (aMapOfArgs.Find ("xdrawname", aValues))
{
aTrihedronData.ChangeXAxisAspect().SetToDrawName (aValues->Value(1).IsEqual ("on"));
aTrihedronData.ChangeXAxisAspect().SetDrawName (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("ydrawname", aValues))
{
aTrihedronData.ChangeYAxisAspect().SetToDrawName (aValues->Value(1).IsEqual ("on"));
aTrihedronData.ChangeYAxisAspect().SetDrawName (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("zdrawname", aValues))
{
aTrihedronData.ChangeZAxisAspect().SetToDrawName (aValues->Value(1).IsEqual ("on"));
aTrihedronData.ChangeZAxisAspect().SetDrawName (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("xnameoffset", aValues))
{
@@ -3881,53 +4016,53 @@ static int VGraduatedTrihedron (Draw_Interpretor& /*theDi*/, Standard_Integer th
// TICKMARKS
if (aMapOfArgs.Find ("xticks", aValues))
{
aTrihedronData.ChangeXAxisAspect().SetTickmarkNumber (aValues->Value(1).IntegerValue());
aTrihedronData.ChangeXAxisAspect().SetTickmarksNumber (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("yticks", aValues))
{
aTrihedronData.ChangeYAxisAspect().SetTickmarkNumber (aValues->Value(1).IntegerValue());
aTrihedronData.ChangeYAxisAspect().SetTickmarksNumber (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("zticks", aValues))
{
aTrihedronData.ChangeZAxisAspect().SetTickmarkNumber (aValues->Value(1).IntegerValue());
aTrihedronData.ChangeZAxisAspect().SetTickmarksNumber (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("xticklength", aValues))
{
aTrihedronData.ChangeXAxisAspect().SetTickmarkLength (aValues->Value(1).IntegerValue());
aTrihedronData.ChangeXAxisAspect().SetTickmarksLength (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("yticklength", aValues))
{
aTrihedronData.ChangeYAxisAspect().SetTickmarkLength (aValues->Value(1).IntegerValue());
aTrihedronData.ChangeYAxisAspect().SetTickmarksLength (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("zticklength", aValues))
{
aTrihedronData.ChangeZAxisAspect().SetTickmarkLength (aValues->Value(1).IntegerValue());
aTrihedronData.ChangeZAxisAspect().SetTickmarksLength (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("xdrawticks", aValues))
{
aTrihedronData.ChangeXAxisAspect().SetToDrawTickmarks (aValues->Value(1).IsEqual ("on"));
aTrihedronData.ChangeXAxisAspect().SetDrawTickmarks (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("ydrawticks", aValues))
{
aTrihedronData.ChangeYAxisAspect().SetToDrawTickmarks (aValues->Value(1).IsEqual ("on"));
aTrihedronData.ChangeYAxisAspect().SetDrawTickmarks (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("zdrawticks", aValues))
{
aTrihedronData.ChangeZAxisAspect().SetToDrawTickmarks (aValues->Value(1).IsEqual ("on"));
aTrihedronData.ChangeZAxisAspect().SetDrawTickmarks (aValues->Value(1).IsEqual ("on"));
}
// VALUES
if (aMapOfArgs.Find ("xdrawvalues", aValues))
{
aTrihedronData.ChangeXAxisAspect().SetToDrawValues (aValues->Value(1).IsEqual ("on"));
aTrihedronData.ChangeXAxisAspect().SetDrawValues (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("ydrawvalues", aValues))
{
aTrihedronData.ChangeYAxisAspect().SetToDrawValues (aValues->Value(1).IsEqual ("on"));
aTrihedronData.ChangeYAxisAspect().SetDrawValues (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("zdrawvalues", aValues))
{
aTrihedronData.ChangeZAxisAspect().SetToDrawValues (aValues->Value(1).IsEqual ("on"));
aTrihedronData.ChangeZAxisAspect().SetDrawValues (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("xvaluesoffset", aValues))
{
@@ -3945,7 +4080,7 @@ static int VGraduatedTrihedron (Draw_Interpretor& /*theDi*/, Standard_Integer th
// ARROWS
if (aMapOfArgs.Find ("arrowlength", aValues))
{
aTrihedronData.SetArrowLength ((Standard_ShortReal) aValues->Value(1).RealValue());
aTrihedronData.SetArrowsLength ((Standard_ShortReal) aValues->Value(1).RealValue());
}
// FONTS
@@ -3958,6 +4093,15 @@ static int VGraduatedTrihedron (Draw_Interpretor& /*theDi*/, Standard_Integer th
aTrihedronData.SetValuesFont (aValues->Value(1));
}
if (aMapOfArgs.Find ("drawgrid", aValues))
{
aTrihedronData.SetDrawGrid (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("drawaxes", aValues))
{
aTrihedronData.SetDrawAxes (aValues->Value(1).IsEqual ("on"));
}
// The final step: display of erase trihedron
if (toDisplay)
{
@@ -7995,10 +8139,13 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"vscale : vscale X Y Z",
__FILE__,VScale,group);
theCommands.Add("vzbufftrihedron",
"vzbufftrihedron [center|left_lower|left_upper|right_lower|right_upper"
" textR=255 textG=255 textB=255 scale=0.1 wireframe|zbuffer]"
" : Displays a V3d_ZBUFFER'ed or V3d_WIREFRAME'd trihedron",
__FILE__,VTestZBuffTrihedron,group);
"vzbufftrihedron [{-on|-off}=-on] [-type {wireframe|zbuffer}=zbuffer]"
"\n\t\t: [-position center|left_lower|left_upper|right_lower|right_upper]"
"\n\t\t: [-scale value=0.1] [-size value=0.8] [-arrowDiam value=0.05]"
"\n\t\t: [-colorArrowX color=RED] [-colorArrowY color=GREEN] [-colorArrowZ color=BLUE]"
"\n\t\t: [-nbfacets value=12] [-colorLabels color=WHITE]"
"\n\t\t: Displays a trihedron",
__FILE__,VZBuffTrihedron,group);
theCommands.Add("vrotate",
"vrotate [[-mouseStart X Y] [-mouseMove X Y]]|[AX AY AZ [X Y Z]]"
"\n : Option -mouseStart starts rotation according to the mouse position"
@@ -8046,6 +8193,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"\t[-xdrawticks on/off] [-ydrawticks on/off] [-zdrawticks on/off]\n"
"\t[-xticks Number] [-yticks Number] [-zticks Number]\n"
"\t[-xticklength IntVal] [-yticklength IntVal] [-zticklength IntVal]\n"
"\t[-drawgrid on/off] [-drawaxes on/off]\n"
" - Displays or erases graduated trihedron"
" - xname, yname, zname - names of axes, default: X, Y, Z\n"
" - namefont - font of axes names. Default: Arial\n"