From 1d7ca641c7dc4091f410f88a57d81ed3f85ac60f Mon Sep 17 00:00:00 2001 From: apl Date: Thu, 21 Nov 2013 17:30:06 +0400 Subject: [PATCH] 0024351: Test cases for AIS dimension presentations to check arrow orientation, text position - Added test cases to check label and arrows positioning of AIS length, angle, radius, diameter dimensions; - Added new arguments to "vdim" command to modify "flyout", "arrow orientation", "label position" properties; - Corrected bug: duplication of text label of linear dimensions for the horizontal-centered text. - Rename and revise argument interface of "vdimension" (vdim) command. - Correct test cases for new command name and arguments style. corrected test cases - check with testdiff instead of "checkcolor" --- src/AIS/AIS_Dimension.cxx | 2 + src/ViewerTest/ViewerTest.cdl | 8 + src/ViewerTest/ViewerTest.cxx | 24 ++ .../ViewerTest_RelationCommands.cxx | 252 ++++++++++++++---- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 25 +- tests/bugs/vis/bug24133_1 | 2 +- tests/bugs/vis/bug24133_2 | 4 +- tests/bugs/vis/bug24133_3 | 4 +- tests/bugs/vis/bug24133_4 | 4 +- tests/bugs/vis/bug24288_1 | 2 +- tests/bugs/vis/bug24288_2 | 2 +- tests/bugs/vis/bug24288_3 | 2 +- tests/bugs/vis/bug24293 | 2 +- tests/bugs/vis/bug24351_1 | 66 +++++ tests/bugs/vis/bug24351_2 | 78 ++++++ tests/bugs/vis/bug24351_3 | 78 ++++++ tests/bugs/vis/bug24351_4 | 72 +++++ 17 files changed, 535 insertions(+), 92 deletions(-) create mode 100644 tests/bugs/vis/bug24351_1 create mode 100644 tests/bugs/vis/bug24351_2 create mode 100644 tests/bugs/vis/bug24351_3 create mode 100644 tests/bugs/vis/bug24351_4 diff --git a/src/AIS/AIS_Dimension.cxx b/src/AIS/AIS_Dimension.cxx index f07387778d..b6d38d985e 100644 --- a/src/AIS/AIS_Dimension.cxx +++ b/src/AIS/AIS_Dimension.cxx @@ -781,6 +781,8 @@ void AIS_Dimension::drawLinearDimension (const Handle(Prs3d_Presentation)& thePr aSecondArrowEnd, aSecondExtensionDir, THE_EMPTY_LABEL, theMode, LabelPosition_None); } + + break; } // ------------------------------------------------------------------------ // // LEFT // diff --git a/src/ViewerTest/ViewerTest.cdl b/src/ViewerTest/ViewerTest.cdl index b7dc7b543b..641a1f20da 100755 --- a/src/ViewerTest/ViewerTest.cdl +++ b/src/ViewerTest/ViewerTest.cdl @@ -197,4 +197,12 @@ is 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 "=" + end; diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index 12fc1f2108..4f54fe5717 100755 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -3478,7 +3478,31 @@ static Standard_Integer TDraft(Draw_Interpretor& di, Standard_Integer argc, cons return 0; } +//============================================================================== +//function : splitParameter +//purpose : Split parameter string to parameter name an parameter value +//============================================================================== +Standard_Boolean ViewerTest::SplitParameter (const TCollection_AsciiString& theString, + TCollection_AsciiString& theName, + TCollection_AsciiString& theValue) +{ + Standard_Integer aParamNameEnd = theString.FirstLocationInSet ("=", 1, theString.Length()); + if (aParamNameEnd == 0) + { + return Standard_False; + } + + TCollection_AsciiString aString (theString); + if (aParamNameEnd != 0) + { + theValue = aString.Split (aParamNameEnd); + aString.Split (aString.Length() - 1); + theName = aString; + } + + return Standard_True; +} //============================================================================ // MyCommands diff --git a/src/ViewerTest/ViewerTest_RelationCommands.cxx b/src/ViewerTest/ViewerTest_RelationCommands.cxx index 68172125ca..8b470704ff 100755 --- a/src/ViewerTest/ViewerTest_RelationCommands.cxx +++ b/src/ViewerTest/ViewerTest_RelationCommands.cxx @@ -191,41 +191,39 @@ static void ComputeNewPlaneForDim (const Handle(AIS_Relation)& R, //======================================================================= //function : VDimBuilder -//purpose : Command for updated dimenasions: angle, length, radius, diameter -//draw args : vdim -{angle|length|radius|diameter} -name={Dim_Name} -// shape1 [shape2 [shape3]] [-text={2d|3d} -plane={xoy|yoz|zox}] +//purpose : Command for building dimension presentations: angle, +// length, radius, diameter //======================================================================= - static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, const char** theArgs) { if (theArgsNb < 2) { - theDi << theArgs[0] << ": command argument is required. Type help for more information.\n"; + std::cerr << theArgs[0] << ": command argument is required. Type help for more information.\n"; return 1; } // Parse parameters TCollection_AsciiString aDimType(theArgs[1]); AIS_KindOfDimension aKindOfDimension; - if (aDimType == "-length") + if (aDimType == "length") { aKindOfDimension = AIS_KOD_LENGTH; } - else if (aDimType == "-angle") + else if (aDimType == "angle") { aKindOfDimension = AIS_KOD_PLANEANGLE; } - else if (aDimType == "-radius") + else if (aDimType == "radius") { aKindOfDimension = AIS_KOD_RADIUS; } - else if (aDimType == "-diameter" || aDimType == "-diam") + else if (aDimType == "diameter" || aDimType == "diam") { aKindOfDimension = AIS_KOD_DIAMETER; } else { - theDi << theArgs[0] << ": wrong type of dimension. Type help for more information.\n"; + std::cerr << theArgs[0] << ": wrong type of dimension. Type help for more information.\n"; return 1; } NCollection_List aShapes; @@ -233,61 +231,181 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons Standard_Boolean isPlaneCustom = Standard_False; TCollection_AsciiString aName; gp_Pln aWorkingPlane; + Standard_Boolean isCustomFlyout = Standard_False; + Standard_Real aCustomFlyout = 0.0; + for (Standard_Integer anIt = 2; anIt < theArgsNb; ++anIt) { - TCollection_AsciiString aParam (theArgs[anIt]); - if (aParam.Search("-text") == 1) + TCollection_AsciiString anArgString = theArgs[anIt]; + TCollection_AsciiString aParamName; + TCollection_AsciiString aParamValue; + if (ViewerTest::SplitParameter (anArgString, aParamName, aParamValue)) { - anAspect->MakeText3d(aParam.Search("3d") != -1 ? Standard_True : Standard_False); - } - else if (aParam.Search("-name") == 1) - { - Standard_Integer aParamNameEnd = aParam.FirstLocationInSet("=",1, aParam.Length()); - if (aParamNameEnd == 0) + aParamName.LowerCase(); + aParamValue.LowerCase(); + + if (aParamName == "text") { - theDi << theArgs[0] << ": no name for dimension.\n"; - return 1; + anAspect->MakeText3d (aParamValue == "3d"); + } + else if (aParamName == "name") + { + if (aParamValue.IsEmpty()) + { + std::cerr << theArgs[0] << ": no name for dimension.\n"; + return 1; + } + + aName = aParamValue; + } + else if (aParamName == "plane") + { + if (aParamValue == "xoy") + { + aWorkingPlane = gp_Pln (gp_Ax3 (gp::XOY())); + } + else if (aParamValue == "zox") + { + aWorkingPlane = gp_Pln (gp_Ax3 (gp::ZOX())); + } + else if (aParamValue == "yoz") + { + aWorkingPlane = gp_Pln (gp_Ax3 (gp::YOZ())); + } + else + { + std::cerr << theArgs[0] << ": wrong plane.\n"; + return 1; + } + + isPlaneCustom = Standard_True; + } + else if (aParamName == "label") + { + NCollection_List aListOfLabelVals; + while (aParamValue.Length() > 0) + { + TCollection_AsciiString aValue = aParamValue; + + Standard_Integer aSeparatorPos = aParamValue.Search (","); + if (aSeparatorPos >= 0) + { + aValue.Trunc (aSeparatorPos - 1); + aParamValue.Remove (aSeparatorPos, 1); + } + + aListOfLabelVals.Append (aValue); + + aParamValue.Remove (1, aValue.Length()); + } + + NCollection_List::Iterator aLabelValueIt (aListOfLabelVals); + for ( ; aLabelValueIt.More(); aLabelValueIt.Next()) + { + aParamValue = aLabelValueIt.Value(); + + if (aParamValue == "left") + { + anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Left); + } + else if (aParamValue == "right") + { + anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Right); + } + else if (aParamValue == "hcenter") + { + anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Center); + } + else if (aParamValue == "hfit") + { + anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Fit); + } + else if (aParamValue == "above") + { + anAspect->SetTextVerticalPosition (Prs3d_DTVP_Above); + } + else if (aParamValue == "below") + { + anAspect->SetTextVerticalPosition (Prs3d_DTVP_Below); + } + else if (aParamValue == "vcenter") + { + anAspect->SetTextVerticalPosition (Prs3d_DTVP_Center); + } + else + { + std::cerr << theArgs[0] << ": invalid label position: \"" << aParamValue << "\".\n"; + return 1; + } + } + } + else if (aParamName == "flyout") + { + if (!aParamValue.IsRealValue()) + { + std::cerr << theArgs[0] << ": numeric value expected for flyout.\n"; + return 1; + } + + aCustomFlyout = aParamValue.RealValue(); + + isCustomFlyout = Standard_True; + } + else if (aParamName == "arrows") + { + if (aParamValue == "external") + { + anAspect->SetArrowOrientation (Prs3d_DAO_External); + } + else if (aParamValue == "internal") + { + anAspect->SetArrowOrientation (Prs3d_DAO_Internal); + } + else if (aParamValue == "fit") + { + anAspect->SetArrowOrientation (Prs3d_DAO_Fit); + } } - aName = aParam.Split(aParamNameEnd); - } - else if (aParam.Search("-plane") == 1) - { - isPlaneCustom = Standard_True; - if (aParam.Search("xoy") != -1) - aWorkingPlane = gp_Pln (gp_Ax3(gp::XOY())); - else if (aParam.Search("zox") != -1) - aWorkingPlane = gp_Pln (gp_Ax3(gp::ZOX())); - else if (aParam.Search("yoz") != -1) - aWorkingPlane = gp_Pln (gp_Ax3(gp::YOZ())); else { - theDi << theArgs[0] << ": wrong plane.\n"; + std::cerr << theArgs[0] << ": unknow parameter: \"" << aParamName << "\".\n"; return 1; } } - else if (aParam.Search("-") != 1) // Shape + else // Shape { - if (!GetMapOfAIS().IsBound2 (aParam)) + if (!GetMapOfAIS().IsBound2 (anArgString)) { - theDi << theArgs[0] << ": wrong name of shape. May be here is a wrong parameter.\n"; + std::cerr << theArgs[0] << ": wrong name of shape. May be here is a wrong parameter.\n"; return 1; } - Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aParam)); + + Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (anArgString)); if (aShape.IsNull()) + { + std::cerr << theArgs[0] << ": wrong name of shape. Not a shape.\n"; return 1; + } + aShapes.Append (aShape); } } + if (aName.IsEmpty()) + { + std::cerr << theArgs[0] << ": no name for dimension.\n"; + return 1; + } + // Build dimension Handle(AIS_Dimension) aDim; switch (aKindOfDimension) { - case AIS_KOD_LENGTH: + case AIS_KOD_LENGTH: { if (!isPlaneCustom) { - theDi << theArgs[0] << ": can build dimension without working plane.\n"; + std::cerr << theArgs[0] << ": can not build dimension without working plane.\n"; return 1; } if (aShapes.Extent() == 1) @@ -295,7 +413,7 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons if (aShapes.First()->Type() == AIS_KOI_Shape && (Handle(AIS_Shape)::DownCast(aShapes.First()))->Shape().ShapeType() != TopAbs_EDGE) { - theDi << theArgs[0] << ": wrong shape type.\n"; + std::cerr << theArgs[0] << ": wrong shape type.\n"; return 1; } aDim = new AIS_LengthDimension (TopoDS::Edge ((Handle(AIS_Shape)::DownCast(aShapes.First()))->Shape()), aWorkingPlane); @@ -317,12 +435,14 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons } else { - theDi << theArgs[0] << ": wrong number of shapes to build dimension.\n"; + std::cerr << theArgs[0] << ": wrong number of shapes to build dimension.\n"; return 1; } + + break; } - break; - case AIS_KOD_PLANEANGLE: + + case AIS_KOD_PLANEANGLE: { if (aShapes.Extent() == 1 && aShapes.First()->Type()==AIS_KOI_Shape) { @@ -340,7 +460,7 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons aDim = new AIS_AngleDimension (TopoDS::Edge(aShape1->Shape()),TopoDS::Edge(aShape2->Shape())); else { - theDi << theArgs[0] << ": wrong shapes for angle dimension.\n"; + std::cerr << theArgs[0] << ": wrong shapes for angle dimension.\n"; return 1; } } @@ -365,12 +485,14 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons } else { - theDi << theArgs[0] << ": wrong number of shapes to build dimension.\n"; + std::cerr << theArgs[0] << ": wrong number of shapes to build dimension.\n"; return 1; } + + break; } - break; - case AIS_KOD_RADIUS: // radius of the circle + + case AIS_KOD_RADIUS: // radius of the circle { if (aShapes.Extent() == 1) { @@ -380,12 +502,14 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons } else { - theDi << theArgs[0] << ": wrong number of shapes to build dimension.\n"; + std::cerr << theArgs[0] << ": wrong number of shapes to build dimension.\n"; return 1; } + + break; } - break; - case AIS_KOD_DIAMETER: + + case AIS_KOD_DIAMETER: { if (aShapes.Extent() == 1) { @@ -395,18 +519,27 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons } else { - theDi << theArgs[0] << ": wrong number of shapes to build dimension.\n"; + std::cerr << theArgs[0] << ": wrong number of shapes to build dimension.\n"; return 1; } + + break; } - break; - default: + + default: { - theDi << theArgs[0] << ": wrong type of dimension. Type help for more information.\n"; + std::cerr << theArgs[0] << ": wrong type of dimension. Type help for more information.\n"; return 1; } } + aDim->SetDimensionAspect (anAspect); + + if (isCustomFlyout) + { + aDim->SetFlyout (aCustomFlyout); + } + if (GetMapOfAIS().IsBound2(aName)) { theDi << theArgs[0] << ": shape with name " << aName.ToCString ()<< " already exists. It will be replaced\n"; @@ -415,7 +548,9 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons TheAISContext()->Remove(anObj, Standard_False); GetMapOfAIS().UnBind2(aName); } + GetMapOfAIS().Bind (aDim,aName); + return 0; } @@ -2374,11 +2509,12 @@ void ViewerTest::RelationCommands(Draw_Interpretor& theCommands) { const char *group = "AISRelations"; - theCommands.Add("vdim", - "vdim -{angle|length|radius|diameter} -name={Dim_Name}" - " shape1 [shape2 [shape3]] [-text={2d|3d} -plane={xoy|yoz|zox}]" - " -Build a angle, length, radius and diameter dimensions;" - " -Workis only with interactive objects", + theCommands.Add("vdimension", + "vdimension {angle|length|radius|diameter} name={Dim_Name} shape1 [shape2 [shape3]]\n" + " [text={2d|3d}] [plane={xoy|yoz|zox}]\n" + " [label={left|right|hcenter|hfit},{above|below|vcenter}]\n" + " [flyout=value] [arrows={external|internal|fit}]\n" + " -Builds angle, length, radius and diameter dimensions.\n" __FILE__,VDimBuilder,group); theCommands.Add("vangledim", diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 9bb9c7e24f..febef29aa4 100755 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -726,27 +726,6 @@ void ViewerTest::RedrawAllViews() } } -//============================================================================== -//function : splitParameter -//purpose : Split parameter string to parameter name an parameter value -//============================================================================== -Standard_Boolean splitParameter (const TCollection_AsciiString& theString, - TCollection_AsciiString& theName, - TCollection_AsciiString& theValue) -{ - Standard_Integer aParamNameEnd = theString.FirstLocationInSet("=",1, theString.Length()); - if (aParamNameEnd == 0) - return Standard_False; - TCollection_AsciiString aString(theString); - if (aParamNameEnd != 0) - { - theValue = aString.Split(aParamNameEnd); - aString.Split(aString.Length()-1); - theName = aString; - } - return Standard_True; -} - //============================================================================== //function : Vinit //purpose : Create the window viewer and initialize all the global variable @@ -770,7 +749,7 @@ static int VInit (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const cha const TCollection_AsciiString anArg = theArgVec[anArgIt]; TCollection_AsciiString anArgCase = anArg; anArgCase.UpperCase(); - if (splitParameter (anArg, aName, aValue)) + if (ViewerTest::SplitParameter (anArg, aName, aValue)) { aName.UpperCase(); if (aName.IsEqual ("NAME")) @@ -5334,7 +5313,7 @@ static int VDefaults (Draw_Interpretor& theDi, { TCollection_AsciiString anArg (theArgVec[anArgIter]); TCollection_AsciiString aKey, aValue; - if (!splitParameter (anArg, aKey, aValue) + if (!ViewerTest::SplitParameter (anArg, aKey, aValue) || aValue.IsEmpty()) { std::cerr << "Error, wrong syntax at: '" << anArg.ToCString() << "'!\n"; diff --git a/tests/bugs/vis/bug24133_1 b/tests/bugs/vis/bug24133_1 index 2f489d5a6e..39df654572 100644 --- a/tests/bugs/vis/bug24133_1 +++ b/tests/bugs/vis/bug24133_1 @@ -11,7 +11,7 @@ pload VISUALIZATION vinit vpoint lengthP1 0 0 0 vpoint lengthP2 50 50 50 -vdim -length -name=dim1 -plane=xoy lengthP1 lengthP2 +vdimension length name=dim1 plane=xoy lengthP1 lengthP2 vdisplay dim1 vfit vmoveto 82 254 diff --git a/tests/bugs/vis/bug24133_2 b/tests/bugs/vis/bug24133_2 index bd179d51f2..d9a321c611 100644 --- a/tests/bugs/vis/bug24133_2 +++ b/tests/bugs/vis/bug24133_2 @@ -12,7 +12,7 @@ vinit vpoint angleP1 0 0 0 vpoint angleP2 50 50 50 vpoint angleP3 50 50 100 -vdim -angle -name=dim1 angleP1 angleP2 angleP3 +vdimension angle name=dim1 angleP1 angleP2 angleP3 vdisplay dim1 vfit vmoveto 249 206 @@ -27,7 +27,7 @@ if { $stat != 1 } { } vinit Viewer2/View2 vdisplay angleP1 angleP2 angleP3 -vdim -angle -name=dim2 -text=3d angleP1 angleP2 angleP3 +vdimension angle name=dim2 text=3d angleP1 angleP2 angleP3 vdisplay dim2 vfit vmoveto 263 251 diff --git a/tests/bugs/vis/bug24133_3 b/tests/bugs/vis/bug24133_3 index 920433bc32..0f1aeedf54 100644 --- a/tests/bugs/vis/bug24133_3 +++ b/tests/bugs/vis/bug24133_3 @@ -14,7 +14,7 @@ vpoint radP2 50 50 0 vpoint radP3 100 0 0 vcircle circle radP1 radP2 radP3 0 verase radP1 radP2 radP3 -vdim -radius -name=dim1 circle +vdimension radius name=dim1 circle vdisplay dim1 vfit vmoveto 123 158 @@ -30,7 +30,7 @@ if { $stat != 1 } { vinit Viewer2/View2 vdisplay circle -vdim -radius -name=dim2 -text=3d circle +vdimension radius name=dim2 text=3d circle vdisplay dim2 vfit vmoveto 191 196 diff --git a/tests/bugs/vis/bug24133_4 b/tests/bugs/vis/bug24133_4 index cf43682a8c..0fdfe9694c 100644 --- a/tests/bugs/vis/bug24133_4 +++ b/tests/bugs/vis/bug24133_4 @@ -14,7 +14,7 @@ vpoint diamP2 50 50 0 vpoint diamP3 100 0 0 vcircle circle diamP1 diamP2 diamP3 0 verase diamP1 diamP2 diamP3 -vdim -diam -name=dim1 circle +vdimension diameter name=dim1 circle vdisplay dim1 vfit vmoveto 208 205 @@ -30,7 +30,7 @@ if { $stat != 1 } { vinit Viewer2/View2 vdisplay circle -vdim -diam -name=dim2 -text=3d circle +vdimension diameter name=dim2 text=3d circle vdisplay dim2 vfit vmoveto 208 205 diff --git a/tests/bugs/vis/bug24288_1 b/tests/bugs/vis/bug24288_1 index c6c3bb8229..8e8655d8d5 100644 --- a/tests/bugs/vis/bug24288_1 +++ b/tests/bugs/vis/bug24288_1 @@ -17,7 +17,7 @@ vpoint radP3 100 0 0 vcircle circle radP1 radP2 radP3 0 vrotate 0 -$m_pi2 0 verase radP1 radP2 radP3 -vdim -radius -name=dim -text=3d circle +vdimension radius name=dim text=3d circle vdisplay dim vfit vmoveto 110 111 diff --git a/tests/bugs/vis/bug24288_2 b/tests/bugs/vis/bug24288_2 index fa506f94ea..263df76f58 100644 --- a/tests/bugs/vis/bug24288_2 +++ b/tests/bugs/vis/bug24288_2 @@ -17,7 +17,7 @@ vpoint radP3 100 0 0 vcircle circle radP1 radP2 radP3 0 vrotate 0 -$m_pi2 0 verase radP1 radP2 radP3 -vdim -radius -name=dim -text=3d circle +vdimension radius name=dim text=3d circle vdisplay dim vfit vmoveto 110 111 diff --git a/tests/bugs/vis/bug24288_3 b/tests/bugs/vis/bug24288_3 index 00e75334cb..4c2f5b8afa 100644 --- a/tests/bugs/vis/bug24288_3 +++ b/tests/bugs/vis/bug24288_3 @@ -17,7 +17,7 @@ vpoint radP3 100 0 0 vcircle circle radP1 radP2 radP3 0 vrotate 0 -$m_pi2 0 verase radP1 radP2 radP3 -vdim -radius -name=dim -text=3d circle +vdimension radius name=dim text=3d circle vdisplay dim vfit vmoveto 110 111 diff --git a/tests/bugs/vis/bug24293 b/tests/bugs/vis/bug24293 index b9e829e4a0..98049f1524 100644 --- a/tests/bugs/vis/bug24293 +++ b/tests/bugs/vis/bug24293 @@ -10,7 +10,7 @@ pload VISUALIZATION vinit vpoint lengthP1 0 0 0 vpoint lengthP2 10 10 10 -vdim -length -name=dim1 -plane=xoy lengthP1 lengthP2 +vdimension length name=dim1 plane=xoy lengthP1 lengthP2 vdisplay dim1 vfit vmoveto 202 191 diff --git a/tests/bugs/vis/bug24351_1 b/tests/bugs/vis/bug24351_1 new file mode 100644 index 0000000000..bf6f9a0e84 --- /dev/null +++ b/tests/bugs/vis/bug24351_1 @@ -0,0 +1,66 @@ +puts "============" +puts "CR24351" +puts "============" +puts "" +####################################################################### +# Test AIS Length dimensions: label position and arrow orientation +####################################################################### +pload VISUALIZATION + +vinit +vright + +set hpos "left hcenter right" +set vpos "above vcenter below" + +# --------------------------------------------------------------------- +# create dimensions with different arrow orientation and fit algorithm +# --------------------------------------------------------------------- + +vpoint arrow_p1 0 0 0 +vpoint arrow_p2 50 0 0 + +vpoint arrow_p3 100 0 0 +vpoint arrow_p4 150 0 0 + +vpoint arrow_p5 0 0 50 +vpoint arrow_p6 10 0 50 + +vpoint arrow_p7 100 0 50 +vpoint arrow_p8 127 0 50 + +vdimension length name=arrow_d1 text=3d plane=zox label=hfit flyout=10.0 arrows=internal arrow_p1 arrow_p2 +vdimension length name=arrow_d2 text=3d plane=zox label=hfit flyout=10.0 arrows=external arrow_p3 arrow_p4 +vdimension length name=arrow_d3 text=3d plane=zox label=hfit flyout=10.0 arrows=fit arrow_p5 arrow_p6 +vdimension length name=arrow_d4 text=3d plane=zox label=hfit flyout=10.0 arrows=fit arrow_p7 arrow_p8 +vdisplay arrow_d1 arrow_d2 arrow_d3 arrow_d4 +vfit + +# ------------------------------------------------ +# create dimension with different label positions +# ------------------------------------------------ + +vinit Viewer2/View2 +vright + +set idx 0 +for {set r 0} {$r < 3} {incr r} { + for {set c 0} {$c < 3} {incr c} { + + set point1 p_[expr "$idx * 2 + 0"] + set point2 p_[expr "$idx * 2 + 1"] + + vpoint $point1 [expr "50.0 * ($c*2 + 0)"] 0.0 [expr "50.0 * $r"] + vpoint $point2 [expr "50.0 * ($c*2 + 1)"] 0.0 [expr "50.0 * $r"] + + set dimension d_$idx + + vdimension length name=$dimension text=3d plane=zox label=[lindex $hpos $c],[lindex $vpos $r] arrows=external flyout=10.0 $point1 $point2 + vdisplay $dimension + + incr idx + } +} +vfit + +set only_screen 1 diff --git a/tests/bugs/vis/bug24351_2 b/tests/bugs/vis/bug24351_2 new file mode 100644 index 0000000000..98f0f79b63 --- /dev/null +++ b/tests/bugs/vis/bug24351_2 @@ -0,0 +1,78 @@ +puts "============" +puts "CR24351" +puts "============" +puts "" +####################################################################### +# Test AIS Diameter dimensions: label position and arrow orientation +####################################################################### +pload VISUALIZATION + +vinit +vright + +set hpos "left hcenter right" +set vpos "above vcenter below" + +# --------------------------------------------------------------------- +# create dimensions with different arrow orientation and fit algorithm +# --------------------------------------------------------------------- + +vpoint circle1_p1 0 0 30 +vpoint circle1_p2 30 0 0 +vpoint circle1_p3 60 0 30 +vcircle circle1 circle1_p1 circle1_p2 circle1_p3 0 +vdimension diameter name=diam1 text=3d plane=zox label=hfit flyout=0 arrows=internal circle1 + +vpoint circle2_p1 100 0 30 +vpoint circle2_p2 130 0 0 +vpoint circle2_p3 160 0 30 +vcircle circle2 circle2_p1 circle2_p2 circle2_p3 0 +vdimension diameter name=diam2 text=3d plane=zox label=hfit flyout=0 arrows=external circle2 + +vpoint circle3_p1 0 0 102 +vpoint circle3_p2 22 0 80 +vpoint circle3_p3 44 0 102 +vcircle circle3 circle3_p1 circle3_p2 circle3_p3 0 +vdimension diameter name=diam3 text=3d plane=zox label=hfit flyout=0 label=hfit arrows=fit circle3 + +vpoint circle4_p1 100 0 92 +vpoint circle4_p2 112 0 80 +vpoint circle4_p3 124 0 92 +vcircle circle4 circle4_p1 circle4_p2 circle4_p3 0 +vdimension diameter name=diam4 text=3d plane=zox label=hfit flyout=0 label=hfit arrows=fit circle4 + +vdisplay diam1 diam2 diam3 diam4 +vfit + +# ------------------------------------------------ +# create dimension with different label positions +# ------------------------------------------------ + +vinit Viewer2/View2 +vright + +set idx 0 +for {set r 0} {$r < 3} {incr r} { + for {set c 0} {$c < 3} {incr c} { + + set point1 p_[expr "$idx * 3 + 0"] + set point2 p_[expr "$idx * 3 + 1"] + set point3 p_[expr "$idx * 3 + 2"] + set circle c_[expr "$idx"] + + vpoint $point1 [expr "80.0 * $c + 0"] 0.0 [expr "60.0 * $r + 22"] + vpoint $point2 [expr "80.0 * $c + 22"] 0.0 [expr "60.0 * $r + 0"] + vpoint $point3 [expr "80.0 * $c + 44"] 0.0 [expr "60.0 * $r + 22"] + vcircle $circle $point1 $point2 $point3 0 + + set dimension d_$idx + + vdimension diameter name=$dimension text=3d plane=zox label=[lindex $hpos $c],[lindex $vpos $r] arrows=external flyout=0.0 $circle + vdisplay $dimension + + incr idx + } +} +vfit + +set only_screen 1 diff --git a/tests/bugs/vis/bug24351_3 b/tests/bugs/vis/bug24351_3 new file mode 100644 index 0000000000..c3c1766867 --- /dev/null +++ b/tests/bugs/vis/bug24351_3 @@ -0,0 +1,78 @@ +puts "============" +puts "CR24351" +puts "============" +puts "" +####################################################################### +# Test AIS Radius dimensions: label position and arrow orientation +####################################################################### +pload VISUALIZATION + +vinit +vright + +set hpos "left hcenter" +set vpos "above vcenter below" + +# --------------------------------------------------------------------- +# create dimensions with different arrow orientation and fit algorithm +# --------------------------------------------------------------------- + +vpoint circle1_p1 0 0 30 +vpoint circle1_p2 30 0 0 +vpoint circle1_p3 60 0 30 +vcircle circle1 circle1_p1 circle1_p2 circle1_p3 0 +vdimension radius name=rad1 text=3d plane=zox label=hfit flyout=0 arrows=internal circle1 + +vpoint circle2_p1 100 0 30 +vpoint circle2_p2 130 0 0 +vpoint circle2_p3 160 0 30 +vcircle circle2 circle2_p1 circle2_p2 circle2_p3 0 +vdimension radius name=rad2 text=3d plane=zox label=hfit flyout=0 arrows=external circle2 + +vpoint circle3_p1 0 0 113 +vpoint circle3_p2 33 0 80 +vpoint circle3_p3 66 0 113 +vcircle circle3 circle3_p1 circle3_p2 circle3_p3 0 +vdimension radius name=rad3 text=3d plane=zox label=hfit flyout=0 arrows=fit circle3 + +vpoint circle4_p1 120 0 95 +vpoint circle4_p2 135 0 80 +vpoint circle4_p3 150 0 95 +vcircle circle4 circle4_p1 circle4_p2 circle4_p3 0 +vdimension radius name=rad4 text=3d plane=zox label=hfit flyout=0 arrows=fit circle4 + +vdisplay rad1 rad2 rad3 rad4 +vfit + +# ------------------------------------------------ +# create dimension with different label positions +# ------------------------------------------------ + +vinit Viewer2/View2 +vright + +set idx 0 +for {set r 0} {$r < 3} {incr r} { + for {set c 0} {$c < 2} {incr c} { + + set point1 p_[expr "$idx * 3 + 0"] + set point2 p_[expr "$idx * 3 + 1"] + set point3 p_[expr "$idx * 3 + 2"] + set circle c_[expr "$idx"] + + vpoint $point1 [expr "90.0 * $c + 0"] 0.0 [expr "80.0 * $r + 33"] + vpoint $point2 [expr "90.0 * $c + 33"] 0.0 [expr "80.0 * $r + 0"] + vpoint $point3 [expr "90.0 * $c + 66"] 0.0 [expr "80.0 * $r + 33"] + vcircle $circle $point1 $point2 $point3 0 + + set dimension r_$idx + + vdimension radius name=$dimension text=3d plane=zox label=[lindex $hpos $c],[lindex $vpos $r] arrows=external flyout=0.0 $circle + vdisplay $dimension + + incr idx + } +} +vfit + +set only_screen 1 diff --git a/tests/bugs/vis/bug24351_4 b/tests/bugs/vis/bug24351_4 new file mode 100644 index 0000000000..589ccfe8e8 --- /dev/null +++ b/tests/bugs/vis/bug24351_4 @@ -0,0 +1,72 @@ +puts "============" +puts "CR24351" +puts "============" +puts "" +####################################################################### +# Test AIS angle dimensions: label position and arrow orientation +####################################################################### +pload VISUALIZATION + +vinit +vright + +set hpos "left hcenter right" +set vpos "above vcenter below" + +# --------------------------------------------------------------------- +# create dimensions with different arrow orientation and fit algorithm +# --------------------------------------------------------------------- + +vpoint angle1_p1 0 0 40 +vpoint angle1_p2 0 0 0 +vpoint angle1_p3 40 0 0 +vdimension angle name=ang1 text=3d plane=zox label=hfit flyout=40.0 arrows=internal angle1_p1 angle1_p2 angle1_p3 + +vpoint angle2_p1 80 0 40 +vpoint angle2_p2 80 0 0 +vpoint angle2_p3 120 0 0 +vdimension angle name=ang2 text=3d plane=zox label=hfit flyout=40.0 arrows=external angle2_p1 angle2_p2 angle2_p3 + +vpoint angle3_p1 0 0 115 +vpoint angle3_p2 0 0 80 +vpoint angle3_p3 35 0 80 +vdimension angle name=ang3 text=3d plane=zox label=hfit flyout=35.0 arrows=fit angle3_p1 angle3_p2 angle3_p3 + +vpoint angle4_p1 80 0 100 +vpoint angle4_p2 80 0 80 +vpoint angle4_p3 100 0 80 +vdimension angle name=ang4 text=3d plane=zox label=hfit flyout=20.0 arrows=fit angle4_p1 angle4_p2 angle4_p3 + +vdisplay ang1 ang2 ang3 ang4 +vfit + +# ------------------------------------------------ +# create dimension with different label positions +# ------------------------------------------------ + +vinit Viewer2/View2 +vright + +set idx 0 +for {set r 0} {$r < 3} {incr r} { + for {set c 0} {$c < 3} {incr c} { + + set point1 p_[expr "$idx * 3 + 0"] + set point2 p_[expr "$idx * 3 + 1"] + set point3 p_[expr "$idx * 3 + 2"] + + vpoint $point1 [expr "60.0 * $c + 0"] 0.0 [expr "60.0 * $r + 40"] + vpoint $point2 [expr "60.0 * $c + 0"] 0.0 [expr "60.0 * $r + 0"] + vpoint $point3 [expr "60.0 * $c + 40"] 0.0 [expr "60.0 * $r + 0"] + + set dimension r_$idx + + vdimension angle name=$dimension text=3d plane=zox label=[lindex $hpos $c],[lindex $vpos $r] arrows=external flyout=40.0 $point1 $point2 $point3 + vdisplay $dimension + + incr idx + } +} +vfit + +set only_screen 1