ClipAttributes.h 8.04 KB
Newer Older
hrchilds's avatar
hrchilds committed
1 2
/*****************************************************************************
*
bonnell's avatar
bonnell committed
3
* Copyright (c) 2000 - 2017, Lawrence Livermore National Security, LLC
hrchilds's avatar
hrchilds committed
4
* Produced at the Lawrence Livermore National Laboratory
5
* LLNL-CODE-442911
hrchilds's avatar
hrchilds committed
6 7
* All rights reserved.
*
8
* This file is  part of VisIt. For  details, see https://visit.llnl.gov/.  The
hrchilds's avatar
hrchilds committed
9 10 11 12 13 14 15 16 17 18
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution  and  use  in  source  and  binary  forms,  with  or  without
* modification, are permitted provided that the following conditions are met:
*
*  - Redistributions of  source code must  retain the above  copyright notice,
*    this list of conditions and the disclaimer below.
*  - Redistributions in binary form must reproduce the above copyright notice,
*    this  list of  conditions  and  the  disclaimer (as noted below)  in  the
19 20 21
*    documentation and/or other materials provided with the distribution.
*  - Neither the name of  the LLNS/LLNL nor the names of  its contributors may
*    be used to endorse or promote products derived from this software without
hrchilds's avatar
hrchilds committed
22 23 24 25 26
*    specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR  IMPLIED WARRANTIES, INCLUDING,  BUT NOT  LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND  FITNESS FOR A PARTICULAR  PURPOSE
27 28 29
* ARE  DISCLAIMED. IN  NO EVENT  SHALL LAWRENCE  LIVERMORE NATIONAL  SECURITY,
* LLC, THE  U.S.  DEPARTMENT OF  ENERGY  OR  CONTRIBUTORS BE  LIABLE  FOR  ANY
* DIRECT,  INDIRECT,   INCIDENTAL,   SPECIAL,   EXEMPLARY,  OR   CONSEQUENTIAL
hrchilds's avatar
hrchilds committed
30 31 32 33 34 35 36 37 38
* DAMAGES (INCLUDING, BUT NOT  LIMITED TO, PROCUREMENT OF  SUBSTITUTE GOODS OR
* SERVICES; LOSS OF  USE, DATA, OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER
* CAUSED  AND  ON  ANY  THEORY  OF  LIABILITY,  WHETHER  IN  CONTRACT,  STRICT
* LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY  WAY
* OUT OF THE  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/

hrchilds's avatar
hrchilds committed
39 40 41 42
#ifndef CLIPATTRIBUTES_H
#define CLIPATTRIBUTES_H
#include <string>
#include <AttributeSubject.h>
43

44
#include <PlaneAttributes.h>
hrchilds's avatar
hrchilds committed
45 46 47 48 49 50 51 52 53 54

// ****************************************************************************
// Class: ClipAttributes
//
// Purpose:
//    This class contains attributes for the clip operator.
//
// Notes:      Autogenerated by xml2atts.
//
// Programmer: xml2atts
55
// Creation:   omitted
hrchilds's avatar
hrchilds committed
56 57 58 59 60 61 62 63 64 65 66 67 68
//
// Modifications:
//   
// ****************************************************************************

class ClipAttributes : public AttributeSubject
{
public:
    enum ClipStyle
    {
        Plane,
        Sphere
    };
69 70 71 72 73 74 75
    enum WhichClipPlane
    {
        None,
        Plane1,
        Plane2,
        Plane3
    };
76 77 78 79 80
    enum Quality
    {
        Fast,
        Accurate
    };
hrchilds's avatar
hrchilds committed
81

82
    // These constructors are for objects of this class
hrchilds's avatar
hrchilds committed
83 84
    ClipAttributes();
    ClipAttributes(const ClipAttributes &obj);
85 86 87 88 89
protected:
    // These constructors are for objects derived from this class
    ClipAttributes(private_tmfs_t tmfs);
    ClipAttributes(const ClipAttributes &obj, private_tmfs_t tmfs);
public:
hrchilds's avatar
hrchilds committed
90 91
    virtual ~ClipAttributes();

92
    virtual ClipAttributes& operator = (const ClipAttributes &obj);
hrchilds's avatar
hrchilds committed
93 94
    virtual bool operator == (const ClipAttributes &obj) const;
    virtual bool operator != (const ClipAttributes &obj) const;
95 96 97 98
private:
    void Init();
    void Copy(const ClipAttributes &obj);
public:
hrchilds's avatar
hrchilds committed
99 100 101 102

    virtual const std::string TypeName() const;
    virtual bool CopyAttributes(const AttributeGroup *);
    virtual AttributeSubject *CreateCompatible(const std::string &) const;
hrchilds's avatar
hrchilds committed
103
    virtual AttributeSubject *NewInstance(bool) const;
hrchilds's avatar
hrchilds committed
104 105 106 107 108 109 110 111 112 113 114 115

    // Property selection methods
    virtual void SelectAll();
    void SelectPlane1Origin();
    void SelectPlane2Origin();
    void SelectPlane3Origin();
    void SelectPlane1Normal();
    void SelectPlane2Normal();
    void SelectPlane3Normal();
    void SelectCenter();

    // Property setting methods
116
    void SetQuality(Quality quality_);
hrchilds's avatar
hrchilds committed
117 118 119 120 121 122 123 124 125 126 127
    void SetFuncType(ClipStyle funcType_);
    void SetPlane1Status(bool plane1Status_);
    void SetPlane2Status(bool plane2Status_);
    void SetPlane3Status(bool plane3Status_);
    void SetPlane1Origin(const double *plane1Origin_);
    void SetPlane2Origin(const double *plane2Origin_);
    void SetPlane3Origin(const double *plane3Origin_);
    void SetPlane1Normal(const double *plane1Normal_);
    void SetPlane2Normal(const double *plane2Normal_);
    void SetPlane3Normal(const double *plane3Normal_);
    void SetPlaneInverse(bool planeInverse_);
128
    void SetPlaneToolControlledClipPlane(WhichClipPlane planeToolControlledClipPlane_);
hrchilds's avatar
hrchilds committed
129 130 131 132 133
    void SetCenter(const double *center_);
    void SetRadius(double radius_);
    void SetSphereInverse(bool sphereInverse_);

    // Property getting methods
134
    Quality      GetQuality() const;
hrchilds's avatar
hrchilds committed
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
    ClipStyle    GetFuncType() const;
    bool         GetPlane1Status() const;
    bool         GetPlane2Status() const;
    bool         GetPlane3Status() const;
    const double *GetPlane1Origin() const;
          double *GetPlane1Origin();
    const double *GetPlane2Origin() const;
          double *GetPlane2Origin();
    const double *GetPlane3Origin() const;
          double *GetPlane3Origin();
    const double *GetPlane1Normal() const;
          double *GetPlane1Normal();
    const double *GetPlane2Normal() const;
          double *GetPlane2Normal();
    const double *GetPlane3Normal() const;
          double *GetPlane3Normal();
    bool         GetPlaneInverse() const;
152
    WhichClipPlane GetPlaneToolControlledClipPlane() const;
hrchilds's avatar
hrchilds committed
153 154 155 156 157 158
    const double *GetCenter() const;
          double *GetCenter();
    double       GetRadius() const;
    bool         GetSphereInverse() const;

    // Persistence methods
hrchilds's avatar
hrchilds committed
159
    virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
hrchilds's avatar
hrchilds committed
160 161 162 163 164 165 166 167
    virtual void SetFromNode(DataNode *node);

    // Enum conversion functions
    static std::string ClipStyle_ToString(ClipStyle);
    static bool ClipStyle_FromString(const std::string &, ClipStyle &);
protected:
    static std::string ClipStyle_ToString(int);
public:
168 169 170 171 172
    static std::string WhichClipPlane_ToString(WhichClipPlane);
    static bool WhichClipPlane_FromString(const std::string &, WhichClipPlane &);
protected:
    static std::string WhichClipPlane_ToString(int);
public:
173 174 175 176 177
    static std::string Quality_ToString(Quality);
    static bool Quality_FromString(const std::string &, Quality &);
protected:
    static std::string Quality_ToString(int);
public:
hrchilds's avatar
hrchilds committed
178 179 180 181 182 183 184

    // Keyframing methods
    virtual std::string               GetFieldName(int index) const;
    virtual AttributeGroup::FieldType GetFieldType(int index) const;
    virtual std::string               GetFieldTypeName(int index) const;
    virtual bool                      FieldsEqual(int index, const AttributeGroup *rhs) const;

185 186
    // User-defined methods
    virtual bool EqualTo(const AttributeGroup *atts) const;
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204

    // IDs that can be used to identify fields in case statements
    enum {
        ID_quality = 0,
        ID_funcType,
        ID_plane1Status,
        ID_plane2Status,
        ID_plane3Status,
        ID_plane1Origin,
        ID_plane2Origin,
        ID_plane3Origin,
        ID_plane1Normal,
        ID_plane2Normal,
        ID_plane3Normal,
        ID_planeInverse,
        ID_planeToolControlledClipPlane,
        ID_center,
        ID_radius,
205 206
        ID_sphereInverse,
        ID__LAST
207 208
    };

hrchilds's avatar
hrchilds committed
209
private:
210
    int    quality;
hrchilds's avatar
hrchilds committed
211 212 213 214 215 216 217 218 219 220 221
    int    funcType;
    bool   plane1Status;
    bool   plane2Status;
    bool   plane3Status;
    double plane1Origin[3];
    double plane2Origin[3];
    double plane3Origin[3];
    double plane1Normal[3];
    double plane2Normal[3];
    double plane3Normal[3];
    bool   planeInverse;
222
    int    planeToolControlledClipPlane;
hrchilds's avatar
hrchilds committed
223 224 225
    double center[3];
    double radius;
    bool   sphereInverse;
226 227 228

    // Static class format string for type map.
    static const char *TypeMapFormatString;
229
    static const private_tmfs_t TmfsStruct;
hrchilds's avatar
hrchilds committed
230
};
231
#define CLIPATTRIBUTES_TMFS "iibbbDDDDDDbiDdb"
hrchilds's avatar
hrchilds committed
232 233

#endif