Made object names accessible from within style modules.

ViewShape objects in the view map, as well as SShape objects
that can be retrieved with ViewShape::sshape(), now have a
getName() method that returns the name of the object from
which each shape is created.  For instance, visible feature
edges of specific mesh objects (e.g., Cube.001 and Cube.002)
can be selected using custom predicate ObjectNamesUP1D as
follows:

class ObjectNamesUP1D(UnaryPredicate1D):
    def __init__(self, names):
        UnaryPredicate1D.__init__(self)
        self._names = names
    def getName(self):
        return "ObjectNamesUP1D"
    def __call__(self, viewEdge):
        return viewEdge.viewShape().getName() in self._names

upred = AndUP1D(QuantitativeInvisibilityUP1D(0),
                ObjectNamesUP1D(["Cube.001", "Cube.002"]))
Operators.select(upred)
This commit is contained in:
2010-05-23 17:11:44 +00:00
parent 2212564f18
commit 96e79172a0
10 changed files with 75 additions and 8 deletions

View File

@@ -50,6 +50,7 @@ public:
: BaseObject()
{
_Id = iBrother._Id;
_Name = iBrother._Name;
if(0 == iBrother._FrsMaterial)
_FrsMaterial = 0;
else
@@ -60,11 +61,13 @@ public:
inline void swap(Rep& ioOther){
std::swap(_BBox,ioOther._BBox);
std::swap(_Id, ioOther._Id);
std::swap(_Name, ioOther._Name);
std::swap(_FrsMaterial,ioOther._FrsMaterial);
}
Rep& operator=(const Rep& iBrother){
if(&iBrother != this){
_Id = iBrother._Id;
_Name = iBrother._Name;
if(0 == iBrother._FrsMaterial)
_FrsMaterial = 0;
else{
@@ -108,11 +111,13 @@ public:
/*! Returns the rep bounding box */
virtual const BBox<Vec3r>& bbox() const {return _BBox;}
inline Id getId() const {return _Id;}
inline const string& getName() const {return _Name;}
inline const FrsMaterial * frs_material() const {return _FrsMaterial;}
/*! Sets the Rep bounding box */
virtual void setBBox(const BBox<Vec3r>& iBox) {_BBox = iBox;}
inline void setId(const Id& id) {_Id = id;}
inline void setName(const string& name) {_Name = name;}
inline void setFrsMaterial(const FrsMaterial& iMaterial)
{
_FrsMaterial = new FrsMaterial(iMaterial);
@@ -121,6 +126,7 @@ public:
private:
BBox<Vec3r> _BBox;
Id _Id;
string _Name;
FrsMaterial *_FrsMaterial;
};