mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b391a95e36 |
@@ -56,6 +56,7 @@
|
|||||||
#include <TopTools_MapOfShape.hxx>
|
#include <TopTools_MapOfShape.hxx>
|
||||||
#include <TopTools_SequenceOfShape.hxx>
|
#include <TopTools_SequenceOfShape.hxx>
|
||||||
#include <BRepExtrema_ExtCC.hxx>
|
#include <BRepExtrema_ExtCC.hxx>
|
||||||
|
#include <ShapeFix_Edge.hxx>
|
||||||
|
|
||||||
static TopoDS_Edge FindEdgeCloseToBisectorPlane(const TopoDS_Vertex& theVertex,
|
static TopoDS_Edge FindEdgeCloseToBisectorPlane(const TopoDS_Vertex& theVertex,
|
||||||
TopoDS_Compound& theComp,
|
TopoDS_Compound& theComp,
|
||||||
@@ -534,6 +535,26 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer
|
|||||||
|
|
||||||
if(bHasNewEdge) {
|
if(bHasNewEdge) {
|
||||||
aNewEdge.Orientation(TopAbs_FORWARD);
|
aNewEdge.Orientation(TopAbs_FORWARD);
|
||||||
|
|
||||||
|
// Refer to BrepFill_Sweep.cxx BuildEdge Construct an edge via an iso
|
||||||
|
gp_Pnt P1, P2;
|
||||||
|
Standard_Real p11, p12, p21, p22;
|
||||||
|
P1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aNewEdge)));
|
||||||
|
P2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aNewEdge)));
|
||||||
|
|
||||||
|
TopoDS_Edge aERef = TopoDS::Edge(fit == 1 ? aE1 : aE2);
|
||||||
|
p11 = P1.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
|
||||||
|
p22 = P2.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
|
||||||
|
p12 = P1.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
|
||||||
|
p21 = P2.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
|
||||||
|
|
||||||
|
if (p11 > p12 && p22 > p21) {
|
||||||
|
aNewEdge.Reverse();
|
||||||
|
}
|
||||||
|
|
||||||
|
// for nonPlane surface, we should add pCurve
|
||||||
|
Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge();
|
||||||
|
sfe->FixAddPCurve(aNewEdge, TopoDS::Face(aFace), Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
TopTools_ListOfShape aOrderedList;
|
TopTools_ListOfShape aOrderedList;
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
#include <limits>
|
|
||||||
// Created on: 2015-03-15
|
// Created on: 2015-03-15
|
||||||
// Created by: Danila ULYANOV
|
// Created by: Danila ULYANOV
|
||||||
// Copyright (c) 2014 OPEN CASCADE SAS
|
// Copyright (c) 2014 OPEN CASCADE SAS
|
||||||
@@ -8,9 +7,8 @@
|
|||||||
// This library is free software; you can redistribute it and/or modify it under
|
// 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
|
// 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
|
// 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_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
// OCCT distribution for complete text of the license and disclaimer of any
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
// warranty.
|
|
||||||
//
|
//
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
@@ -23,36 +21,36 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
//! Converts the given string to lowercase
|
//! Converts the given string to lowercase
|
||||||
//! @param theString the string to be converted
|
//! @param theString the string to be converted
|
||||||
//! @return a converted string (a string in lowercase)
|
//! @return a converted string (a string in lowercase)
|
||||||
static std::string toLowerCase(std::string theString) {
|
static std::string toLowerCase (std::string theString)
|
||||||
std::transform(theString.begin(), theString.end(), theString.begin(),
|
{
|
||||||
::LowerCase);
|
std::transform (theString.begin(), theString.end(), theString.begin(), ::LowerCase);
|
||||||
return theString;
|
return theString;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Converts the vector of std::strings to a vector of pointers to its data
|
//! Converts the vector of std::strings to a vector of pointers to its data
|
||||||
//! @param theStringList the vector of strings to be converted
|
//! @param theStringList the vector of strings to be converted
|
||||||
//! @return a vector of pointers to the data of given strings
|
//! @return a vector of pointers to the data of given strings
|
||||||
static std::vector<const char *>
|
static std::vector<const char*> convertToRawStringList (const std::vector<std::string>& theStringList)
|
||||||
convertToRawStringList(const std::vector<std::string> &theStringList) {
|
{
|
||||||
const std::size_t aListSize = theStringList.size();
|
const std::size_t aListSize = theStringList.size();
|
||||||
std::vector<const char *> aRawStringList(aListSize);
|
std::vector<const char*> aRawStringList (aListSize);
|
||||||
for (std::size_t anIndex = 0; anIndex < aListSize; ++anIndex) {
|
for (std::size_t anIndex = 0; anIndex < aListSize; ++anIndex)
|
||||||
aRawStringList[anIndex] = theStringList[anIndex].c_str();
|
{
|
||||||
|
aRawStringList[anIndex] = theStringList[anIndex].c_str();
|
||||||
|
}
|
||||||
|
return aRawStringList;
|
||||||
}
|
}
|
||||||
return aRawStringList;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
const std::size_t ViewerTest_CmdParser::THE_UNNAMED_COMMAND_OPTION_KEY =
|
const std::size_t ViewerTest_CmdParser::THE_UNNAMED_COMMAND_OPTION_KEY = (std::numeric_limits<std::size_t>::max)();
|
||||||
(std::numeric_limits<std::size_t>::max)();
|
|
||||||
|
|
||||||
const std::size_t ViewerTest_CmdParser::THE_HELP_COMMAND_OPTION_KEY = 0;
|
const std::size_t ViewerTest_CmdParser::THE_HELP_COMMAND_OPTION_KEY = 0;
|
||||||
|
|
||||||
@@ -60,48 +58,50 @@ const std::size_t ViewerTest_CmdParser::THE_HELP_COMMAND_OPTION_KEY = 0;
|
|||||||
// function : ViewerTest_CmdParser
|
// function : ViewerTest_CmdParser
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
ViewerTest_CmdParser::ViewerTest_CmdParser(const std::string &theDescription)
|
ViewerTest_CmdParser::ViewerTest_CmdParser (const std::string& theDescription) : myDescription (theDescription)
|
||||||
: myDescription(theDescription) {
|
{
|
||||||
AddOption("help|h",
|
AddOption ("help|h", "Prints a short description of the command and its options.");
|
||||||
"Prints a short description of the command and its options.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : AddOption
|
// function : AddOption
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
ViewerTest_CommandOptionKey
|
ViewerTest_CommandOptionKey ViewerTest_CmdParser::AddOption (const std::string& theOptionNames,
|
||||||
ViewerTest_CmdParser::AddOption(const std::string &theOptionNames,
|
const std::string& theOptionDescription)
|
||||||
const std::string &theOptionDescription) {
|
{
|
||||||
CommandOption aNewOption;
|
CommandOption aNewOption;
|
||||||
|
|
||||||
// extract option names
|
// extract option names
|
||||||
std::vector<std::string> aNames;
|
std::vector<std::string> aNames;
|
||||||
std::stringstream aStream(theOptionNames);
|
std::stringstream aStream (theOptionNames);
|
||||||
std::string anItem;
|
std::string anItem;
|
||||||
while (std::getline(aStream, anItem, '|')) {
|
while (std::getline (aStream, anItem, '|'))
|
||||||
if (!anItem.empty()) {
|
{
|
||||||
aNames.push_back(anItem);
|
if (!anItem.empty())
|
||||||
|
{
|
||||||
|
aNames.push_back (anItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aNewOption.Name = aNames.front();
|
aNewOption.Name = aNames.front();
|
||||||
if (aNames.size() > 1) {
|
if (aNames.size() > 1)
|
||||||
|
{
|
||||||
const std::size_t aNumberOfAliases = aNames.size() - 1;
|
const std::size_t aNumberOfAliases = aNames.size() - 1;
|
||||||
|
|
||||||
aNewOption.Aliases.reserve(aNumberOfAliases);
|
aNewOption.Aliases.reserve (aNumberOfAliases);
|
||||||
std::copy(aNames.begin() + 1, aNames.end(),
|
std::copy (aNames.begin() + 1, aNames.end(), std::back_inserter (aNewOption.Aliases));
|
||||||
std::back_inserter(aNewOption.Aliases));
|
|
||||||
}
|
}
|
||||||
aNewOption.Description = theOptionDescription;
|
aNewOption.Description = theOptionDescription;
|
||||||
|
|
||||||
const ViewerTest_CommandOptionKey aNewOptionKey = myOptionStorage.size();
|
const ViewerTest_CommandOptionKey aNewOptionKey = myOptionStorage.size();
|
||||||
|
|
||||||
myOptionStorage.push_back(aNewOption);
|
myOptionStorage.push_back (aNewOption);
|
||||||
|
|
||||||
std::vector<std::string>::const_iterator anIt = aNames.begin();
|
std::vector<std::string>::const_iterator anIt = aNames.begin();
|
||||||
for (; anIt != aNames.end(); ++anIt) {
|
for (; anIt != aNames.end(); ++anIt)
|
||||||
const std::string aNameInLowerCase = toLowerCase(*anIt);
|
{
|
||||||
|
const std::string aNameInLowerCase = toLowerCase (*anIt);
|
||||||
|
|
||||||
myOptionMap[aNameInLowerCase] = aNewOptionKey;
|
myOptionMap[aNameInLowerCase] = aNewOptionKey;
|
||||||
}
|
}
|
||||||
@@ -113,18 +113,21 @@ ViewerTest_CmdParser::AddOption(const std::string &theOptionNames,
|
|||||||
// function : PrintHelp
|
// function : PrintHelp
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
void ViewerTest_CmdParser::PrintHelp() const {
|
void ViewerTest_CmdParser::PrintHelp() const
|
||||||
|
{
|
||||||
std::cout << myDescription << std::endl;
|
std::cout << myDescription << std::endl;
|
||||||
std::vector<CommandOption>::const_iterator anIt = myOptionStorage.begin();
|
std::vector<CommandOption>::const_iterator anIt = myOptionStorage.begin();
|
||||||
for (++anIt; anIt != myOptionStorage.end(); ++anIt) {
|
for (++anIt; anIt != myOptionStorage.end(); ++anIt)
|
||||||
const CommandOption &aCommandOption = *anIt;
|
{
|
||||||
|
const CommandOption& aCommandOption = *anIt;
|
||||||
std::cout << "\n\t-" << aCommandOption.Name;
|
std::cout << "\n\t-" << aCommandOption.Name;
|
||||||
const OptionAliases &anAliases = aCommandOption.Aliases;
|
const OptionAliases& anAliases = aCommandOption.Aliases;
|
||||||
if (!anAliases.empty()) {
|
if (!anAliases.empty())
|
||||||
|
{
|
||||||
std::cout << " (-" << anAliases.front();
|
std::cout << " (-" << anAliases.front();
|
||||||
for (OptionAliases::const_iterator anAliasIterator =
|
for (OptionAliases::const_iterator anAliasIterator = anAliases.begin() + 1; anAliasIterator != anAliases.end();
|
||||||
anAliases.begin() + 1;
|
++anAliasIterator)
|
||||||
anAliasIterator != anAliases.end(); ++anAliasIterator) {
|
{
|
||||||
std::cout << ", -" << *anAliasIterator;
|
std::cout << ", -" << *anAliasIterator;
|
||||||
}
|
}
|
||||||
std::cout << ")";
|
std::cout << ")";
|
||||||
@@ -138,28 +141,34 @@ void ViewerTest_CmdParser::PrintHelp() const {
|
|||||||
// function : Parse
|
// function : Parse
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
void ViewerTest_CmdParser::Parse(const Standard_Integer theArgsNb,
|
void ViewerTest_CmdParser::Parse (const Standard_Integer theArgsNb, const char* const* const theArgVec)
|
||||||
const char *const *const theArgVec) {
|
{
|
||||||
std::size_t aCurrentUsedOptionIndex = 0;
|
std::size_t aCurrentUsedOptionIndex = 0;
|
||||||
for (Standard_Integer anIter = 1; anIter < theArgsNb; ++anIter) {
|
for (Standard_Integer anIter = 1; anIter < theArgsNb; ++anIter)
|
||||||
const char *const anArgument = theArgVec[anIter];
|
{
|
||||||
if (anArgument[0] == '-' && !std::isdigit(anArgument[1])) {
|
const char* const anArgument = theArgVec[anIter];
|
||||||
const std::string anOptionName = toLowerCase(anArgument + 1);
|
if (anArgument[0] == '-' && !std::isdigit (anArgument[1]))
|
||||||
OptionMap::iterator aMapIter = myOptionMap.find(anOptionName);
|
{
|
||||||
if (aMapIter != myOptionMap.end()) {
|
const std::string anOptionName = toLowerCase (anArgument + 1);
|
||||||
const ViewerTest_CommandOptionKey aCurrentUsedOptionKey =
|
OptionMap::iterator aMapIter = myOptionMap.find (anOptionName);
|
||||||
aMapIter->second;
|
if (aMapIter != myOptionMap.end())
|
||||||
aCurrentUsedOptionIndex = addUsedOption(aCurrentUsedOptionKey);
|
{
|
||||||
} else {
|
const ViewerTest_CommandOptionKey aCurrentUsedOptionKey = aMapIter->second;
|
||||||
Message::SendFail()
|
aCurrentUsedOptionIndex = addUsedOption (aCurrentUsedOptionKey);
|
||||||
<< "Error: unknown argument '" << anOptionName << "'";
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Message::SendFail() << "Error: unknown argument '" << anOptionName << "'";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (anIter == 1) {
|
else
|
||||||
aCurrentUsedOptionIndex = addUsedOption(THE_UNNAMED_COMMAND_OPTION_KEY);
|
{
|
||||||
|
if (anIter == 1)
|
||||||
|
{
|
||||||
|
aCurrentUsedOptionIndex = addUsedOption (THE_UNNAMED_COMMAND_OPTION_KEY);
|
||||||
}
|
}
|
||||||
myOptionArgumentStorage[aCurrentUsedOptionIndex].push_back(anArgument);
|
myOptionArgumentStorage[aCurrentUsedOptionIndex].push_back (anArgument);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,9 +177,10 @@ void ViewerTest_CmdParser::Parse(const Standard_Integer theArgsNb,
|
|||||||
// function : GetOptionNameByKey
|
// function : GetOptionNameByKey
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
std::string ViewerTest_CmdParser::GetOptionNameByKey(
|
std::string ViewerTest_CmdParser::GetOptionNameByKey (const ViewerTest_CommandOptionKey theOptionKey) const
|
||||||
const ViewerTest_CommandOptionKey theOptionKey) const {
|
{
|
||||||
if (theOptionKey == THE_UNNAMED_COMMAND_OPTION_KEY) {
|
if (theOptionKey == THE_UNNAMED_COMMAND_OPTION_KEY)
|
||||||
|
{
|
||||||
return "Unnamed";
|
return "Unnamed";
|
||||||
}
|
}
|
||||||
return myOptionStorage[theOptionKey].Name;
|
return myOptionStorage[theOptionKey].Name;
|
||||||
@@ -180,13 +190,14 @@ std::string ViewerTest_CmdParser::GetOptionNameByKey(
|
|||||||
// function : GetUsedOptions
|
// function : GetUsedOptions
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
ViewerTest_CommandOptionKeySet ViewerTest_CmdParser::GetUsedOptions() const {
|
ViewerTest_CommandOptionKeySet ViewerTest_CmdParser::GetUsedOptions() const
|
||||||
|
{
|
||||||
ViewerTest_CommandOptionKeySet aUsedOptions;
|
ViewerTest_CommandOptionKeySet aUsedOptions;
|
||||||
for (UsedOptionMap::const_iterator aUsedOptionMapIterator =
|
for (UsedOptionMap::const_iterator aUsedOptionMapIterator = myUsedOptionMap.begin();
|
||||||
myUsedOptionMap.begin();
|
|
||||||
aUsedOptionMapIterator != myUsedOptionMap.end();
|
aUsedOptionMapIterator != myUsedOptionMap.end();
|
||||||
++aUsedOptionMapIterator) {
|
++aUsedOptionMapIterator)
|
||||||
aUsedOptions.insert(aUsedOptionMapIterator->first);
|
{
|
||||||
|
aUsedOptions.insert (aUsedOptionMapIterator->first);
|
||||||
}
|
}
|
||||||
return aUsedOptions;
|
return aUsedOptions;
|
||||||
}
|
}
|
||||||
@@ -195,7 +206,8 @@ ViewerTest_CommandOptionKeySet ViewerTest_CmdParser::GetUsedOptions() const {
|
|||||||
// function : HasNoOption
|
// function : HasNoOption
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
bool ViewerTest_CmdParser::HasNoOption() const {
|
bool ViewerTest_CmdParser::HasNoOption() const
|
||||||
|
{
|
||||||
return myUsedOptionMap.empty();
|
return myUsedOptionMap.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,16 +215,17 @@ bool ViewerTest_CmdParser::HasNoOption() const {
|
|||||||
// function : HasUnnamedOption
|
// function : HasUnnamedOption
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
bool ViewerTest_CmdParser::HasUnnamedOption() const {
|
bool ViewerTest_CmdParser::HasUnnamedOption() const
|
||||||
return myUsedOptionMap.find(THE_UNNAMED_COMMAND_OPTION_KEY) !=
|
{
|
||||||
myUsedOptionMap.end();
|
return myUsedOptionMap.find (THE_UNNAMED_COMMAND_OPTION_KEY) != myUsedOptionMap.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : HasNoUnnamedOption
|
// function : HasNoUnnamedOption
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
bool ViewerTest_CmdParser::HasOnlyUnnamedOption() const {
|
bool ViewerTest_CmdParser::HasOnlyUnnamedOption() const
|
||||||
|
{
|
||||||
return HasUnnamedOption() && (myUsedOptionMap.size() == 1);
|
return HasUnnamedOption() && (myUsedOptionMap.size() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,37 +233,37 @@ bool ViewerTest_CmdParser::HasOnlyUnnamedOption() const {
|
|||||||
// function : HasOption
|
// function : HasOption
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
bool ViewerTest_CmdParser::HasOption(
|
bool ViewerTest_CmdParser::HasOption (const std::string& theOptionName,
|
||||||
const std::string &theOptionName,
|
const std::size_t theMandatoryArgsNb /* = 0 */,
|
||||||
const std::size_t theMandatoryArgsNb /* = 0 */,
|
const bool isFatal /* = false */) const
|
||||||
const bool isFatal /* = false */) const {
|
{
|
||||||
ViewerTest_CommandOptionKey anOptionKey;
|
ViewerTest_CommandOptionKey anOptionKey;
|
||||||
if (!findOptionKey(theOptionName, anOptionKey)) {
|
if (!findOptionKey (theOptionName, anOptionKey))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return HasOption(anOptionKey, theMandatoryArgsNb, isFatal);
|
return HasOption (anOptionKey, theMandatoryArgsNb, isFatal);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : HasOption
|
// function : HasOption
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
bool ViewerTest_CmdParser::HasOption(
|
bool ViewerTest_CmdParser::HasOption (const ViewerTest_CommandOptionKey theOptionKey,
|
||||||
const ViewerTest_CommandOptionKey theOptionKey,
|
const std::size_t theMandatoryArgsNb /* = 0 */,
|
||||||
const std::size_t theMandatoryArgsNb /* = 0 */,
|
const bool isFatal /* = false */) const
|
||||||
const bool isFatal /* = false */) const {
|
{
|
||||||
std::size_t aUsedOptionIndex = 0;
|
std::size_t aUsedOptionIndex = 0;
|
||||||
if (!findUsedOptionIndex(theOptionKey, aUsedOptionIndex)) {
|
if (!findUsedOptionIndex (theOptionKey, aUsedOptionIndex))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const OptionArguments &anOptionArguments =
|
const OptionArguments& anOptionArguments = myOptionArgumentStorage[aUsedOptionIndex];
|
||||||
myOptionArgumentStorage[aUsedOptionIndex];
|
const bool aResult = (anOptionArguments.size() >= theMandatoryArgsNb);
|
||||||
const bool aResult = (anOptionArguments.size() >= theMandatoryArgsNb);
|
if (isFatal && !aResult)
|
||||||
if (isFatal && !aResult) {
|
{
|
||||||
Message::SendFail() << "Error: wrong syntax at option '"
|
Message::SendFail() << "Error: wrong syntax at option '" << myOptionStorage[theOptionKey].Name << "'\n"
|
||||||
<< myOptionStorage[theOptionKey].Name << "'\n"
|
<< "At least " << theMandatoryArgsNb << "expected, but only " << anOptionArguments.size()
|
||||||
<< "At least " << theMandatoryArgsNb
|
|
||||||
<< "expected, but only " << anOptionArguments.size()
|
|
||||||
<< "provided.";
|
<< "provided.";
|
||||||
}
|
}
|
||||||
return aResult;
|
return aResult;
|
||||||
@@ -260,63 +273,68 @@ bool ViewerTest_CmdParser::HasOption(
|
|||||||
// function : GetNumberOfOptionArguments
|
// function : GetNumberOfOptionArguments
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
Standard_Integer ViewerTest_CmdParser::GetNumberOfOptionArguments(
|
Standard_Integer ViewerTest_CmdParser::GetNumberOfOptionArguments (const std::string& theOptionName) const
|
||||||
const std::string &theOptionName) const {
|
{
|
||||||
ViewerTest_CommandOptionKey anOptionKey = THE_UNNAMED_COMMAND_OPTION_KEY;
|
ViewerTest_CommandOptionKey anOptionKey = THE_UNNAMED_COMMAND_OPTION_KEY;
|
||||||
if (!findOptionKey(theOptionName, anOptionKey)) {
|
if (!findOptionKey (theOptionName, anOptionKey))
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return GetNumberOfOptionArguments(anOptionKey);
|
return GetNumberOfOptionArguments (anOptionKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : GetNumberOfOptionArguments
|
// function : GetNumberOfOptionArguments
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
Standard_Integer ViewerTest_CmdParser::GetNumberOfOptionArguments(
|
Standard_Integer ViewerTest_CmdParser::GetNumberOfOptionArguments (const ViewerTest_CommandOptionKey theOptionKey) const
|
||||||
const ViewerTest_CommandOptionKey theOptionKey) const {
|
{
|
||||||
std::size_t aUsedOptionIndex = 0;
|
std::size_t aUsedOptionIndex = 0;
|
||||||
if (!findUsedOptionIndex(theOptionKey, aUsedOptionIndex)) {
|
if (!findUsedOptionIndex (theOptionKey, aUsedOptionIndex))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return static_cast<Standard_Integer>(
|
return static_cast<Standard_Integer> (myOptionArgumentStorage[aUsedOptionIndex].size());
|
||||||
myOptionArgumentStorage[aUsedOptionIndex].size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : Arg
|
// function : Arg
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
bool ViewerTest_CmdParser::Arg(const std::string &theOptionName,
|
bool ViewerTest_CmdParser::Arg (const std::string& theOptionName,
|
||||||
const Standard_Integer theArgumentIndex,
|
const Standard_Integer theArgumentIndex,
|
||||||
std::string &theOptionArgument) const {
|
std::string& theOptionArgument) const
|
||||||
Standard_ASSERT_RETURN(
|
{
|
||||||
theArgumentIndex >= 0,
|
Standard_ASSERT_RETURN (theArgumentIndex >= 0,
|
||||||
"'theArgumentIndex' must be greater than or equal to zero.", false);
|
"'theArgumentIndex' must be greater than or equal to zero.",
|
||||||
|
false);
|
||||||
ViewerTest_CommandOptionKey anOptionKey = THE_UNNAMED_COMMAND_OPTION_KEY;
|
ViewerTest_CommandOptionKey anOptionKey = THE_UNNAMED_COMMAND_OPTION_KEY;
|
||||||
if (!theOptionName.empty() && !findOptionKey(theOptionName, anOptionKey)) {
|
if (!theOptionName.empty() && !findOptionKey (theOptionName, anOptionKey))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Arg(anOptionKey, theArgumentIndex, theOptionArgument);
|
return Arg (anOptionKey, theArgumentIndex, theOptionArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : Arg
|
// function : Arg
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
bool ViewerTest_CmdParser::Arg(const ViewerTest_CommandOptionKey theOptionKey,
|
bool ViewerTest_CmdParser::Arg (const ViewerTest_CommandOptionKey theOptionKey,
|
||||||
const Standard_Integer theArgumentIndex,
|
const Standard_Integer theArgumentIndex,
|
||||||
std::string &theOptionArgument) const {
|
std::string& theOptionArgument) const
|
||||||
Standard_ASSERT_RETURN(
|
{
|
||||||
theArgumentIndex >= 0,
|
Standard_ASSERT_RETURN (theArgumentIndex >= 0,
|
||||||
"'theArgumentIndex' must be greater than or equal to zero.", false);
|
"'theArgumentIndex' must be greater than or equal to zero.",
|
||||||
|
false);
|
||||||
std::size_t aUsedOptionIndex = 0;
|
std::size_t aUsedOptionIndex = 0;
|
||||||
if (!findUsedOptionIndex(theOptionKey, aUsedOptionIndex)) {
|
if (!findUsedOptionIndex (theOptionKey, aUsedOptionIndex))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const OptionArguments &anOptionArguments =
|
const OptionArguments& anOptionArguments = myOptionArgumentStorage[aUsedOptionIndex];
|
||||||
myOptionArgumentStorage[aUsedOptionIndex];
|
if (static_cast<std::size_t> (theArgumentIndex) >= anOptionArguments.size())
|
||||||
if (static_cast<std::size_t>(theArgumentIndex) >= anOptionArguments.size()) {
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
theOptionArgument = anOptionArguments[theArgumentIndex];
|
theOptionArgument = anOptionArguments[theArgumentIndex];
|
||||||
@@ -327,15 +345,14 @@ bool ViewerTest_CmdParser::Arg(const ViewerTest_CommandOptionKey theOptionKey,
|
|||||||
// function : Arg
|
// function : Arg
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
std::string
|
std::string ViewerTest_CmdParser::Arg (const std::string& theOptionName, const Standard_Integer theArgumentIndex) const
|
||||||
ViewerTest_CmdParser::Arg(const std::string &theOptionName,
|
{
|
||||||
const Standard_Integer theArgumentIndex) const {
|
Standard_ASSERT_RETURN (theArgumentIndex >= 0,
|
||||||
Standard_ASSERT_RETURN(
|
"'theArgumentIndex' must be greater than or equal to zero.",
|
||||||
theArgumentIndex >= 0,
|
std::string());
|
||||||
"'theArgumentIndex' must be greater than or equal to zero.",
|
|
||||||
std::string());
|
|
||||||
std::string anOptionArgument;
|
std::string anOptionArgument;
|
||||||
if (!Arg(theOptionName, theArgumentIndex, anOptionArgument)) {
|
if (!Arg (theOptionName, theArgumentIndex, anOptionArgument))
|
||||||
|
{
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
return anOptionArgument;
|
return anOptionArgument;
|
||||||
@@ -345,11 +362,12 @@ ViewerTest_CmdParser::Arg(const std::string &theOptionName,
|
|||||||
// function : Arg
|
// function : Arg
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
std::string
|
std::string ViewerTest_CmdParser::Arg (const ViewerTest_CommandOptionKey theOptionKey,
|
||||||
ViewerTest_CmdParser::Arg(const ViewerTest_CommandOptionKey theOptionKey,
|
const Standard_Integer theArgumentIndex) const
|
||||||
const Standard_Integer theArgumentIndex) const {
|
{
|
||||||
std::string anOptionArgument;
|
std::string anOptionArgument;
|
||||||
if (!Arg(theOptionKey, theArgumentIndex, anOptionArgument)) {
|
if (!Arg (theOptionKey, theArgumentIndex, anOptionArgument))
|
||||||
|
{
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
return anOptionArgument;
|
return anOptionArgument;
|
||||||
@@ -359,92 +377,86 @@ ViewerTest_CmdParser::Arg(const ViewerTest_CommandOptionKey theOptionKey,
|
|||||||
// function : ArgVec3f
|
// function : ArgVec3f
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
Graphic3d_Vec3
|
Graphic3d_Vec3 ViewerTest_CmdParser::ArgVec3f (const std::string& theOptionName,
|
||||||
ViewerTest_CmdParser::ArgVec3f(const std::string &theOptionName,
|
Standard_Integer theArgumentIndex) const
|
||||||
Standard_Integer theArgumentIndex) const {
|
{
|
||||||
return Graphic3d_Vec3(static_cast<Standard_ShortReal>(Draw::Atof(
|
return Graphic3d_Vec3 (
|
||||||
Arg(theOptionName, theArgumentIndex).c_str())),
|
static_cast<Standard_ShortReal> (Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str())),
|
||||||
static_cast<Standard_ShortReal>(Draw::Atof(
|
static_cast<Standard_ShortReal> (Draw::Atof (Arg (theOptionName, theArgumentIndex + 1).c_str())),
|
||||||
Arg(theOptionName, theArgumentIndex + 1).c_str())),
|
static_cast<Standard_ShortReal> (Draw::Atof (Arg (theOptionName, theArgumentIndex + 2).c_str())));
|
||||||
static_cast<Standard_ShortReal>(Draw::Atof(
|
|
||||||
Arg(theOptionName, theArgumentIndex + 2).c_str())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : ArgVec3d
|
// function : ArgVec3d
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
Graphic3d_Vec3d
|
Graphic3d_Vec3d ViewerTest_CmdParser::ArgVec3d (const std::string& theOptionName,
|
||||||
ViewerTest_CmdParser::ArgVec3d(const std::string &theOptionName,
|
Standard_Integer theArgumentIndex) const
|
||||||
Standard_Integer theArgumentIndex) const {
|
{
|
||||||
return Graphic3d_Vec3d(
|
return Graphic3d_Vec3d (Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()),
|
||||||
Draw::Atof(Arg(theOptionName, theArgumentIndex).c_str()),
|
Draw::Atof (Arg (theOptionName, theArgumentIndex + 1).c_str()),
|
||||||
Draw::Atof(Arg(theOptionName, theArgumentIndex + 1).c_str()),
|
Draw::Atof (Arg (theOptionName, theArgumentIndex + 2).c_str()));
|
||||||
Draw::Atof(Arg(theOptionName, theArgumentIndex + 2).c_str()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : ArgVec
|
// function : ArgVec
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
gp_Vec ViewerTest_CmdParser::ArgVec(const std::string &theOptionName,
|
gp_Vec ViewerTest_CmdParser::ArgVec (const std::string& theOptionName, Standard_Integer theArgumentIndex) const
|
||||||
Standard_Integer theArgumentIndex) const {
|
{
|
||||||
return gp_Vec(Draw::Atof(Arg(theOptionName, theArgumentIndex).c_str()),
|
return gp_Vec (Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()),
|
||||||
Draw::Atof(Arg(theOptionName, theArgumentIndex + 1).c_str()),
|
Draw::Atof (Arg (theOptionName, theArgumentIndex + 1).c_str()),
|
||||||
Draw::Atof(Arg(theOptionName, theArgumentIndex + 2).c_str()));
|
Draw::Atof (Arg (theOptionName, theArgumentIndex + 2).c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : ArgPnt
|
// function : ArgPnt
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
gp_Pnt ViewerTest_CmdParser::ArgPnt(const std::string &theOptionName,
|
gp_Pnt ViewerTest_CmdParser::ArgPnt (const std::string& theOptionName, Standard_Integer theArgumentIndex) const
|
||||||
Standard_Integer theArgumentIndex) const {
|
{
|
||||||
return gp_Pnt(Draw::Atof(Arg(theOptionName, theArgumentIndex).c_str()),
|
return gp_Pnt (Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()),
|
||||||
Draw::Atof(Arg(theOptionName, theArgumentIndex + 1).c_str()),
|
Draw::Atof (Arg (theOptionName, theArgumentIndex + 1).c_str()),
|
||||||
Draw::Atof(Arg(theOptionName, theArgumentIndex + 2).c_str()));
|
Draw::Atof (Arg (theOptionName, theArgumentIndex + 2).c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : ArgDouble
|
// function : ArgDouble
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
Standard_Real
|
Standard_Real ViewerTest_CmdParser::ArgDouble (const std::string& theOptionName,
|
||||||
ViewerTest_CmdParser::ArgDouble(const std::string &theOptionName,
|
Standard_Integer theArgumentIndex) const
|
||||||
Standard_Integer theArgumentIndex) const {
|
{
|
||||||
return Draw::Atof(Arg(theOptionName, theArgumentIndex).c_str());
|
return Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : ArgFloat
|
// function : ArgFloat
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
Standard_ShortReal
|
Standard_ShortReal ViewerTest_CmdParser::ArgFloat (const std::string& theOptionName,
|
||||||
ViewerTest_CmdParser::ArgFloat(const std::string &theOptionName,
|
Standard_Integer theArgumentIndex) const
|
||||||
Standard_Integer theArgumentIndex) const {
|
{
|
||||||
return static_cast<Standard_ShortReal>(
|
return static_cast<Standard_ShortReal> (Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()));
|
||||||
Draw::Atof(Arg(theOptionName, theArgumentIndex).c_str()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : ArgInt
|
// function : ArgInt
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
Standard_Integer
|
Standard_Integer ViewerTest_CmdParser::ArgInt (const std::string& theOptionName,
|
||||||
ViewerTest_CmdParser::ArgInt(const std::string &theOptionName,
|
const Standard_Integer theArgumentIndex) const
|
||||||
const Standard_Integer theArgumentIndex) const {
|
{
|
||||||
return static_cast<Standard_Integer>(
|
return static_cast<Standard_Integer> (Draw::Atoi (Arg (theOptionName, theArgumentIndex).c_str()));
|
||||||
Draw::Atoi(Arg(theOptionName, theArgumentIndex).c_str()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : ArgBool
|
// function : ArgBool
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
bool ViewerTest_CmdParser::ArgBool(
|
bool ViewerTest_CmdParser::ArgBool (const std::string& theOptionName, const Standard_Integer theArgumentIndex) const
|
||||||
const std::string &theOptionName,
|
{
|
||||||
const Standard_Integer theArgumentIndex) const {
|
return Draw::Atoi (Arg (theOptionName, theArgumentIndex).c_str()) != 0;
|
||||||
return Draw::Atoi(Arg(theOptionName, theArgumentIndex).c_str()) != 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
@@ -452,55 +464,54 @@ bool ViewerTest_CmdParser::ArgBool(
|
|||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
template <typename TheColor>
|
template <typename TheColor>
|
||||||
bool ViewerTest_CmdParser::ArgColor(const std::string &theOptionName,
|
bool ViewerTest_CmdParser::ArgColor (const std::string& theOptionName,
|
||||||
Standard_Integer &theArgumentIndex,
|
Standard_Integer& theArgumentIndex,
|
||||||
TheColor &theColor) const {
|
TheColor& theColor) const
|
||||||
|
{
|
||||||
ViewerTest_CommandOptionKey anOptionKey;
|
ViewerTest_CommandOptionKey anOptionKey;
|
||||||
if (!findOptionKey(theOptionName, anOptionKey)) {
|
if (!findOptionKey (theOptionName, anOptionKey))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return ArgColor(anOptionKey, theArgumentIndex, theColor);
|
return ArgColor (anOptionKey, theArgumentIndex, theColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! ViewerTest_CmdParser::ArgColor() explicit template instantiation definitions
|
//! ViewerTest_CmdParser::ArgColor() explicit template instantiation definitions
|
||||||
template bool ViewerTest_CmdParser::ArgColor(const std::string &theOptionName,
|
template bool ViewerTest_CmdParser::ArgColor (const std::string& theOptionName,
|
||||||
Standard_Integer &theArgumentIndex,
|
Standard_Integer& theArgumentIndex,
|
||||||
Quantity_Color &theColor) const;
|
Quantity_Color& theColor) const;
|
||||||
|
|
||||||
template bool
|
template bool ViewerTest_CmdParser::ArgColor (const std::string& theOptionName,
|
||||||
ViewerTest_CmdParser::ArgColor(const std::string &theOptionName,
|
Standard_Integer& theArgumentIndex,
|
||||||
Standard_Integer &theArgumentIndex,
|
Quantity_ColorRGBA& theColor) const;
|
||||||
Quantity_ColorRGBA &theColor) const;
|
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : ArgColor
|
// function : ArgColor
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
template <typename TheColor>
|
template <typename TheColor>
|
||||||
bool ViewerTest_CmdParser::ArgColor(
|
bool ViewerTest_CmdParser::ArgColor (const ViewerTest_CommandOptionKey theOptionKey,
|
||||||
const ViewerTest_CommandOptionKey theOptionKey,
|
Standard_Integer& theArgumentIndex,
|
||||||
Standard_Integer &theArgumentIndex, TheColor &theColor) const {
|
TheColor& theColor) const
|
||||||
|
{
|
||||||
std::size_t aUsedOptionIndex = 0;
|
std::size_t aUsedOptionIndex = 0;
|
||||||
if (!findUsedOptionIndex(theOptionKey, aUsedOptionIndex)) {
|
if (!findUsedOptionIndex (theOptionKey, aUsedOptionIndex))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const RawStringArguments aRawStringArguments =
|
const RawStringArguments aRawStringArguments = getRawStringArguments (aUsedOptionIndex);
|
||||||
getRawStringArguments(aUsedOptionIndex);
|
const Standard_Integer aNumberOfArguments = static_cast<Standard_Integer> (aRawStringArguments.size());
|
||||||
const Standard_Integer aNumberOfArguments =
|
Standard_ASSERT_RETURN (theArgumentIndex < aNumberOfArguments,
|
||||||
static_cast<Standard_Integer>(aRawStringArguments.size());
|
"'theArgumentIndex' must be less than the number of command-line arguments "
|
||||||
Standard_ASSERT_RETURN(
|
"passed with the option which access key is 'theOptionKey'.",
|
||||||
theArgumentIndex < aNumberOfArguments,
|
false);
|
||||||
"'theArgumentIndex' must be less than the number of command-line "
|
const Standard_Integer aNumberOfAvailableArguments = aNumberOfArguments - theArgumentIndex;
|
||||||
"arguments "
|
TheColor aColor;
|
||||||
"passed with the option which access key is 'theOptionKey'.",
|
const Standard_Integer aNumberOfParsedArguments = Draw::ParseColor (aNumberOfAvailableArguments,
|
||||||
false);
|
&aRawStringArguments[theArgumentIndex],
|
||||||
const Standard_Integer aNumberOfAvailableArguments =
|
aColor);
|
||||||
aNumberOfArguments - theArgumentIndex;
|
if (aNumberOfParsedArguments == 0)
|
||||||
TheColor aColor;
|
{
|
||||||
const Standard_Integer aNumberOfParsedArguments =
|
|
||||||
Draw::ParseColor(aNumberOfAvailableArguments,
|
|
||||||
&aRawStringArguments[theArgumentIndex], aColor);
|
|
||||||
if (aNumberOfParsedArguments == 0) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
theArgumentIndex += aNumberOfParsedArguments;
|
theArgumentIndex += aNumberOfParsedArguments;
|
||||||
@@ -509,27 +520,25 @@ bool ViewerTest_CmdParser::ArgColor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! ViewerTest_CmdParser::ArgColor() explicit template instantiation definitions
|
//! ViewerTest_CmdParser::ArgColor() explicit template instantiation definitions
|
||||||
template bool
|
template bool ViewerTest_CmdParser::ArgColor (ViewerTest_CommandOptionKey theOptionKey,
|
||||||
ViewerTest_CmdParser::ArgColor(ViewerTest_CommandOptionKey theOptionKey,
|
Standard_Integer& theArgumentIndex,
|
||||||
Standard_Integer &theArgumentIndex,
|
Quantity_Color& theColor) const;
|
||||||
Quantity_Color &theColor) const;
|
|
||||||
|
|
||||||
template bool
|
template bool ViewerTest_CmdParser::ArgColor (ViewerTest_CommandOptionKey theOptionKey,
|
||||||
ViewerTest_CmdParser::ArgColor(ViewerTest_CommandOptionKey theOptionKey,
|
Standard_Integer& theArgumentIndex,
|
||||||
Standard_Integer &theArgumentIndex,
|
Quantity_ColorRGBA& theColor) const;
|
||||||
Quantity_ColorRGBA &theColor) const;
|
|
||||||
|
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
// function : findUsedOptionKey
|
// function : findUsedOptionKey
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
bool ViewerTest_CmdParser::findOptionKey(
|
bool ViewerTest_CmdParser::findOptionKey (const std::string& theOptionName,
|
||||||
const std::string &theOptionName,
|
ViewerTest_CommandOptionKey& theOptionKey) const
|
||||||
ViewerTest_CommandOptionKey &theOptionKey) const {
|
{
|
||||||
const std::string anOptionNameInLowercase = toLowerCase(theOptionName);
|
const std::string anOptionNameInLowercase = toLowerCase (theOptionName);
|
||||||
const OptionMap::const_iterator aMapIter =
|
const OptionMap::const_iterator aMapIter = myOptionMap.find (anOptionNameInLowercase);
|
||||||
myOptionMap.find(anOptionNameInLowercase);
|
if (aMapIter == myOptionMap.end())
|
||||||
if (aMapIter == myOptionMap.end()) {
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
theOptionKey = aMapIter->second;
|
theOptionKey = aMapIter->second;
|
||||||
@@ -540,12 +549,12 @@ bool ViewerTest_CmdParser::findOptionKey(
|
|||||||
// function : findUsedOptionKey
|
// function : findUsedOptionKey
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
bool ViewerTest_CmdParser::findUsedOptionIndex(
|
bool ViewerTest_CmdParser::findUsedOptionIndex (const ViewerTest_CommandOptionKey theOptionKey,
|
||||||
const ViewerTest_CommandOptionKey theOptionKey,
|
std::size_t& theUsedOptionIndex) const
|
||||||
std::size_t &theUsedOptionIndex) const {
|
{
|
||||||
const UsedOptionMap::const_iterator aUsedOptionIterator =
|
const UsedOptionMap::const_iterator aUsedOptionIterator = myUsedOptionMap.find (theOptionKey);
|
||||||
myUsedOptionMap.find(theOptionKey);
|
if (aUsedOptionIterator == myUsedOptionMap.end())
|
||||||
if (aUsedOptionIterator == myUsedOptionMap.end()) {
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
theUsedOptionIndex = aUsedOptionIterator->second;
|
theUsedOptionIndex = aUsedOptionIterator->second;
|
||||||
@@ -556,14 +565,16 @@ bool ViewerTest_CmdParser::findUsedOptionIndex(
|
|||||||
// function : findUsedOptionIndex
|
// function : findUsedOptionIndex
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
bool ViewerTest_CmdParser::findUsedOptionIndex(
|
bool ViewerTest_CmdParser::findUsedOptionIndex (const std::string& theOptionName, std::size_t& theUsedOptionIndex) const
|
||||||
const std::string &theOptionName, std::size_t &theUsedOptionIndex) const {
|
{
|
||||||
ViewerTest_CommandOptionKey anOptionKey = THE_UNNAMED_COMMAND_OPTION_KEY;
|
ViewerTest_CommandOptionKey anOptionKey = THE_UNNAMED_COMMAND_OPTION_KEY;
|
||||||
if (!findOptionKey(theOptionName, anOptionKey)) {
|
if (!findOptionKey (theOptionName, anOptionKey))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::size_t aUsedOptionIndex = 0;
|
std::size_t aUsedOptionIndex = 0;
|
||||||
if (!findUsedOptionIndex(anOptionKey, aUsedOptionIndex)) {
|
if (!findUsedOptionIndex (anOptionKey, aUsedOptionIndex))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
theUsedOptionIndex = aUsedOptionIndex;
|
theUsedOptionIndex = aUsedOptionIndex;
|
||||||
@@ -574,10 +585,10 @@ bool ViewerTest_CmdParser::findUsedOptionIndex(
|
|||||||
// function : addUsedOption
|
// function : addUsedOption
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
std::size_t ViewerTest_CmdParser::addUsedOption(
|
std::size_t ViewerTest_CmdParser::addUsedOption (const ViewerTest_CommandOptionKey theNewUsedOptionKey)
|
||||||
const ViewerTest_CommandOptionKey theNewUsedOptionKey) {
|
{
|
||||||
const std::size_t aNewUsedOptionIndex = myOptionArgumentStorage.size();
|
const std::size_t aNewUsedOptionIndex = myOptionArgumentStorage.size();
|
||||||
myOptionArgumentStorage.push_back(OptionArguments());
|
myOptionArgumentStorage.push_back (OptionArguments());
|
||||||
myUsedOptionMap[theNewUsedOptionKey] = aNewUsedOptionIndex;
|
myUsedOptionMap[theNewUsedOptionKey] = aNewUsedOptionIndex;
|
||||||
return aNewUsedOptionIndex;
|
return aNewUsedOptionIndex;
|
||||||
}
|
}
|
||||||
@@ -586,14 +597,13 @@ std::size_t ViewerTest_CmdParser::addUsedOption(
|
|||||||
// function : getRawStringArguments
|
// function : getRawStringArguments
|
||||||
// purpose :
|
// purpose :
|
||||||
//===============================================================================================
|
//===============================================================================================
|
||||||
ViewerTest_CmdParser::RawStringArguments
|
ViewerTest_CmdParser::RawStringArguments ViewerTest_CmdParser::getRawStringArguments (
|
||||||
ViewerTest_CmdParser::getRawStringArguments(
|
const std::size_t theUsedOptionIndex) const
|
||||||
const std::size_t theUsedOptionIndex) const {
|
{
|
||||||
Standard_ASSERT_RETURN(theUsedOptionIndex < myOptionArgumentStorage.size(),
|
Standard_ASSERT_RETURN (
|
||||||
"'theUsedOptionIndex' must be less than the size of "
|
theUsedOptionIndex < myOptionArgumentStorage.size(),
|
||||||
"'myOptionArgumentStorage'.",
|
"'theUsedOptionIndex' must be less than the size of 'myOptionArgumentStorage'.",
|
||||||
RawStringArguments());
|
RawStringArguments());
|
||||||
const OptionArguments &anOptionArguments =
|
const OptionArguments& anOptionArguments = myOptionArgumentStorage[theUsedOptionIndex];
|
||||||
myOptionArgumentStorage[theUsedOptionIndex];
|
return convertToRawStringList (anOptionArguments);
|
||||||
return convertToRawStringList(anOptionArguments);
|
|
||||||
}
|
}
|
||||||
|
18
tests/pipe/bugs/bug32818
Normal file
18
tests/pipe/bugs/bug32818
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "0032818: Modeling Algorithms - Result of sweep operation is invalid"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
restore [locate_data_file bug32818.brep]
|
||||||
|
explode bug32818
|
||||||
|
renamevar bug32818_1 p
|
||||||
|
renamevar bug32818_2 pr
|
||||||
|
|
||||||
|
mksweep p
|
||||||
|
setsweep -CF
|
||||||
|
addsweep pr
|
||||||
|
|
||||||
|
buildsweep result -R -S
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
checknbshapes result -vertex 80 -edge 160 -wire 80 -face 80 -shell 1 -solid 1
|
Reference in New Issue
Block a user