ConeAttributes.C 24.1 KB
Newer Older
hrchilds's avatar
hrchilds committed
1 2
/*****************************************************************************
*
3
* Copyright (c) 2000 - 2012, 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 43 44 45 46 47 48 49 50 51 52
#include <ConeAttributes.h>
#include <DataNode.h>

//
// Enum conversion methods for ConeAttributes::Representation
//

static const char *Representation_strings[] = {
"ThreeD", "Flattened", "R_Theta"
};

std::string
ConeAttributes::Representation_ToString(ConeAttributes::Representation t)
{
hrchilds's avatar
hrchilds committed
53 54 55
    int index = int(t);
    if(index < 0 || index >= 3) index = 0;
    return Representation_strings[index];
hrchilds's avatar
hrchilds committed
56 57 58 59 60
}

std::string
ConeAttributes::Representation_ToString(int t)
{
hrchilds's avatar
hrchilds committed
61 62
    int index = (t < 0 || t >= 3) ? 0 : t;
    return Representation_strings[index];
hrchilds's avatar
hrchilds committed
63 64 65 66 67
}

bool
ConeAttributes::Representation_FromString(const std::string &s, ConeAttributes::Representation &val)
{
hrchilds's avatar
hrchilds committed
68
    val = ConeAttributes::ThreeD;
hrchilds's avatar
hrchilds committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
    for(int i = 0; i < 3; ++i)
    {
        if(s == Representation_strings[i])
        {
            val = (Representation)i;
            return true;
        }
    }
    return false;
}

// ****************************************************************************
// Method: ConeAttributes::ConeAttributes
//
// Purpose: 
bonnell's avatar
bonnell committed
84
//   Init utility for the ConeAttributes class.
hrchilds's avatar
hrchilds committed
85 86 87 88
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
89
// Creation:   omitted
hrchilds's avatar
hrchilds committed
90 91 92 93 94
//
// Modifications:
//   
// ****************************************************************************

bonnell's avatar
bonnell committed
95
void ConeAttributes::Init()
hrchilds's avatar
hrchilds committed
96 97 98 99 100 101 102 103 104 105 106 107 108 109
{
    angle = 45;
    origin[0] = 0;
    origin[1] = 0;
    origin[2] = 0;
    normal[0] = 0;
    normal[1] = 0;
    normal[2] = 1;
    representation = Flattened;
    upAxis[0] = 0;
    upAxis[1] = 1;
    upAxis[2] = 0;
    cutByLength = false;
    length = 1;
bonnell's avatar
bonnell committed
110 111

    ConeAttributes::SelectAll();
hrchilds's avatar
hrchilds committed
112 113 114 115 116 117
}

// ****************************************************************************
// Method: ConeAttributes::ConeAttributes
//
// Purpose: 
bonnell's avatar
bonnell committed
118
//   Copy utility for the ConeAttributes class.
hrchilds's avatar
hrchilds committed
119 120 121 122
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
123
// Creation:   omitted
hrchilds's avatar
hrchilds committed
124 125 126 127 128
//
// Modifications:
//   
// ****************************************************************************

bonnell's avatar
bonnell committed
129
void ConeAttributes::Copy(const ConeAttributes &obj)
hrchilds's avatar
hrchilds committed
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
{
    angle = obj.angle;
    origin[0] = obj.origin[0];
    origin[1] = obj.origin[1];
    origin[2] = obj.origin[2];

    normal[0] = obj.normal[0];
    normal[1] = obj.normal[1];
    normal[2] = obj.normal[2];

    representation = obj.representation;
    upAxis[0] = obj.upAxis[0];
    upAxis[1] = obj.upAxis[1];
    upAxis[2] = obj.upAxis[2];

    cutByLength = obj.cutByLength;
    length = obj.length;

bonnell's avatar
bonnell committed
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
    ConeAttributes::SelectAll();
}

// Type map format string
const char *ConeAttributes::TypeMapFormatString = CONEATTRIBUTES_TMFS;
const AttributeGroup::private_tmfs_t ConeAttributes::TmfsStruct = {CONEATTRIBUTES_TMFS};


// ****************************************************************************
// Method: ConeAttributes::ConeAttributes
//
// Purpose: 
//   Default constructor for the ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//   
// ****************************************************************************

ConeAttributes::ConeAttributes() : 
    AttributeSubject(ConeAttributes::TypeMapFormatString)
{
    ConeAttributes::Init();
}

// ****************************************************************************
// Method: ConeAttributes::ConeAttributes
//
// Purpose: 
//   Constructor for the derived classes of ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//   
// ****************************************************************************

ConeAttributes::ConeAttributes(private_tmfs_t tmfs) : 
    AttributeSubject(tmfs.tmfs)
{
    ConeAttributes::Init();
}

// ****************************************************************************
// Method: ConeAttributes::ConeAttributes
//
// Purpose: 
//   Copy constructor for the ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//   
// ****************************************************************************

ConeAttributes::ConeAttributes(const ConeAttributes &obj) : 
    AttributeSubject(ConeAttributes::TypeMapFormatString)
{
    ConeAttributes::Copy(obj);
}

// ****************************************************************************
// Method: ConeAttributes::ConeAttributes
//
// Purpose: 
//   Copy constructor for derived classes of the ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//   
// ****************************************************************************

ConeAttributes::ConeAttributes(const ConeAttributes &obj, private_tmfs_t tmfs) : 
    AttributeSubject(tmfs.tmfs)
{
    ConeAttributes::Copy(obj);
hrchilds's avatar
hrchilds committed
238 239 240 241 242 243 244 245 246 247 248
}

// ****************************************************************************
// Method: ConeAttributes::~ConeAttributes
//
// Purpose: 
//   Destructor for the ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
249
// Creation:   omitted
hrchilds's avatar
hrchilds committed
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
//
// Modifications:
//   
// ****************************************************************************

ConeAttributes::~ConeAttributes()
{
    // nothing here
}

// ****************************************************************************
// Method: ConeAttributes::operator = 
//
// Purpose: 
//   Assignment operator for the ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
269
// Creation:   omitted
hrchilds's avatar
hrchilds committed
270 271 272 273 274
//
// Modifications:
//   
// ****************************************************************************

275
ConeAttributes& 
hrchilds's avatar
hrchilds committed
276 277
ConeAttributes::operator = (const ConeAttributes &obj)
{
278
    if (this == &obj) return *this;
hrchilds's avatar
hrchilds committed
279

bonnell's avatar
bonnell committed
280
    ConeAttributes::Copy(obj);
hrchilds's avatar
hrchilds committed
281

282
    return *this;
hrchilds's avatar
hrchilds committed
283 284 285 286 287 288 289 290 291 292 293
}

// ****************************************************************************
// Method: ConeAttributes::operator == 
//
// Purpose: 
//   Comparison operator == for the ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
294
// Creation:   omitted
hrchilds's avatar
hrchilds committed
295 296 297 298 299 300 301 302 303 304
//
// Modifications:
//   
// ****************************************************************************

bool
ConeAttributes::operator == (const ConeAttributes &obj) const
{
    // Compare the origin arrays.
    bool origin_equal = true;
305
    for(int i = 0; i < 3 && origin_equal; ++i)
hrchilds's avatar
hrchilds committed
306 307 308 309
        origin_equal = (origin[i] == obj.origin[i]);

    // Compare the normal arrays.
    bool normal_equal = true;
310
    for(int i = 0; i < 3 && normal_equal; ++i)
hrchilds's avatar
hrchilds committed
311 312 313 314
        normal_equal = (normal[i] == obj.normal[i]);

    // Compare the upAxis arrays.
    bool upAxis_equal = true;
315
    for(int i = 0; i < 3 && upAxis_equal; ++i)
hrchilds's avatar
hrchilds committed
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
        upAxis_equal = (upAxis[i] == obj.upAxis[i]);

    // Create the return value
    return ((angle == obj.angle) &&
            origin_equal &&
            normal_equal &&
            (representation == obj.representation) &&
            upAxis_equal &&
            (cutByLength == obj.cutByLength) &&
            (length == obj.length));
}

// ****************************************************************************
// Method: ConeAttributes::operator != 
//
// Purpose: 
//   Comparison operator != for the ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
337
// Creation:   omitted
hrchilds's avatar
hrchilds committed
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
//
// Modifications:
//   
// ****************************************************************************

bool
ConeAttributes::operator != (const ConeAttributes &obj) const
{
    return !(this->operator == (obj));
}

// ****************************************************************************
// Method: ConeAttributes::TypeName
//
// Purpose: 
//   Type name method for the ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
358
// Creation:   omitted
hrchilds's avatar
hrchilds committed
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
//
// Modifications:
//   
// ****************************************************************************

const std::string
ConeAttributes::TypeName() const
{
    return "ConeAttributes";
}

// ****************************************************************************
// Method: ConeAttributes::CopyAttributes
//
// Purpose: 
//   CopyAttributes method for the ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
379
// Creation:   omitted
hrchilds's avatar
hrchilds committed
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
//
// Modifications:
//   
// ****************************************************************************

bool
ConeAttributes::CopyAttributes(const AttributeGroup *atts)
{
    if(TypeName() != atts->TypeName())
        return false;

    // Call assignment operator.
    const ConeAttributes *tmp = (const ConeAttributes *)atts;
    *this = *tmp;

    return true;
}

// ****************************************************************************
// Method: ConeAttributes::CreateCompatible
//
// Purpose: 
//   CreateCompatible method for the ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
407
// Creation:   omitted
hrchilds's avatar
hrchilds committed
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
//
// Modifications:
//   
// ****************************************************************************

AttributeSubject *
ConeAttributes::CreateCompatible(const std::string &tname) const
{
    AttributeSubject *retval = 0;
    if(TypeName() == tname)
        retval = new ConeAttributes(*this);
    // Other cases could go here too. 

    return retval;
}

hrchilds's avatar
hrchilds committed
424 425 426 427 428 429 430 431 432
// ****************************************************************************
// Method: ConeAttributes::NewInstance
//
// Purpose: 
//   NewInstance method for the ConeAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
433
// Creation:   omitted
hrchilds's avatar
hrchilds committed
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450
//
// Modifications:
//   
// ****************************************************************************

AttributeSubject *
ConeAttributes::NewInstance(bool copy) const
{
    AttributeSubject *retval = 0;
    if(copy)
        retval = new ConeAttributes(*this);
    else
        retval = new ConeAttributes;

    return retval;
}

hrchilds's avatar
hrchilds committed
451 452 453 454 455 456 457 458 459
// ****************************************************************************
// Method: ConeAttributes::SelectAll
//
// Purpose: 
//   Selects all attributes.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
460
// Creation:   omitted
hrchilds's avatar
hrchilds committed
461 462 463 464 465 466 467 468
//
// Modifications:
//   
// ****************************************************************************

void
ConeAttributes::SelectAll()
{
469 470 471 472 473 474 475
    Select(ID_angle,          (void *)&angle);
    Select(ID_origin,         (void *)origin, 3);
    Select(ID_normal,         (void *)normal, 3);
    Select(ID_representation, (void *)&representation);
    Select(ID_upAxis,         (void *)upAxis, 3);
    Select(ID_cutByLength,    (void *)&cutByLength);
    Select(ID_length,         (void *)&length);
hrchilds's avatar
hrchilds committed
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
}

///////////////////////////////////////////////////////////////////////////////
// Persistence methods
///////////////////////////////////////////////////////////////////////////////

// ****************************************************************************
// Method: ConeAttributes::CreateNode
//
// Purpose: 
//   This method creates a DataNode representation of the object so it can be saved to a config file.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
491
// Creation:   omitted
hrchilds's avatar
hrchilds committed
492 493 494 495 496 497
//
// Modifications:
//   
// ****************************************************************************

bool
hrchilds's avatar
hrchilds committed
498
ConeAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forceAdd)
hrchilds's avatar
hrchilds committed
499 500 501 502 503 504 505 506 507
{
    if(parentNode == 0)
        return false;

    ConeAttributes defaultObject;
    bool addToParent = false;
    // Create a node for ConeAttributes.
    DataNode *node = new DataNode("ConeAttributes");

508
    if(completeSave || !FieldsEqual(ID_angle, &defaultObject))
hrchilds's avatar
hrchilds committed
509 510 511 512 513
    {
        addToParent = true;
        node->AddNode(new DataNode("angle", angle));
    }

514
    if(completeSave || !FieldsEqual(ID_origin, &defaultObject))
hrchilds's avatar
hrchilds committed
515 516 517 518 519
    {
        addToParent = true;
        node->AddNode(new DataNode("origin", origin, 3));
    }

520
    if(completeSave || !FieldsEqual(ID_normal, &defaultObject))
hrchilds's avatar
hrchilds committed
521 522 523 524 525
    {
        addToParent = true;
        node->AddNode(new DataNode("normal", normal, 3));
    }

526
    if(completeSave || !FieldsEqual(ID_representation, &defaultObject))
hrchilds's avatar
hrchilds committed
527 528 529 530 531
    {
        addToParent = true;
        node->AddNode(new DataNode("representation", Representation_ToString(representation)));
    }

532
    if(completeSave || !FieldsEqual(ID_upAxis, &defaultObject))
hrchilds's avatar
hrchilds committed
533 534 535 536 537
    {
        addToParent = true;
        node->AddNode(new DataNode("upAxis", upAxis, 3));
    }

538
    if(completeSave || !FieldsEqual(ID_cutByLength, &defaultObject))
hrchilds's avatar
hrchilds committed
539 540 541 542 543
    {
        addToParent = true;
        node->AddNode(new DataNode("cutByLength", cutByLength));
    }

544
    if(completeSave || !FieldsEqual(ID_length, &defaultObject))
hrchilds's avatar
hrchilds committed
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568
    {
        addToParent = true;
        node->AddNode(new DataNode("length", length));
    }


    // Add the node to the parent node.
    if(addToParent || forceAdd)
        parentNode->AddNode(node);
    else
        delete node;

    return (addToParent || forceAdd);
}

// ****************************************************************************
// Method: ConeAttributes::SetFromNode
//
// Purpose: 
//   This method sets attributes in this object from values in a DataNode representation of the object.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
569
// Creation:   omitted
hrchilds's avatar
hrchilds committed
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595
//
// Modifications:
//   
// ****************************************************************************

void
ConeAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("ConeAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("angle")) != 0)
        SetAngle(node->AsDouble());
    if((node = searchNode->GetNode("origin")) != 0)
        SetOrigin(node->AsDoubleArray());
    if((node = searchNode->GetNode("normal")) != 0)
        SetNormal(node->AsDoubleArray());
    if((node = searchNode->GetNode("representation")) != 0)
    {
        // Allow enums to be int or string in the config file
        if(node->GetNodeType() == INT_NODE)
hrchilds's avatar
hrchilds committed
596 597 598 599 600
        {
            int ival = node->AsInt();
            if(ival >= 0 && ival < 3)
                SetRepresentation(Representation(ival));
        }
hrchilds's avatar
hrchilds committed
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
        else if(node->GetNodeType() == STRING_NODE)
        {
            Representation value;
            if(Representation_FromString(node->AsString(), value))
                SetRepresentation(value);
        }
    }
    if((node = searchNode->GetNode("upAxis")) != 0)
        SetUpAxis(node->AsDoubleArray());
    if((node = searchNode->GetNode("cutByLength")) != 0)
        SetCutByLength(node->AsBool());
    if((node = searchNode->GetNode("length")) != 0)
        SetLength(node->AsDouble());
}

///////////////////////////////////////////////////////////////////////////////
// Set property methods
///////////////////////////////////////////////////////////////////////////////

void
ConeAttributes::SetAngle(double angle_)
{
    angle = angle_;
624
    Select(ID_angle, (void *)&angle);
hrchilds's avatar
hrchilds committed
625 626 627 628 629 630 631 632
}

void
ConeAttributes::SetOrigin(const double *origin_)
{
    origin[0] = origin_[0];
    origin[1] = origin_[1];
    origin[2] = origin_[2];
633
    Select(ID_origin, (void *)origin, 3);
hrchilds's avatar
hrchilds committed
634 635 636 637 638 639 640 641
}

void
ConeAttributes::SetNormal(const double *normal_)
{
    normal[0] = normal_[0];
    normal[1] = normal_[1];
    normal[2] = normal_[2];
642
    Select(ID_normal, (void *)normal, 3);
hrchilds's avatar
hrchilds committed
643 644 645 646 647 648
}

void
ConeAttributes::SetRepresentation(ConeAttributes::Representation representation_)
{
    representation = representation_;
649
    Select(ID_representation, (void *)&representation);
hrchilds's avatar
hrchilds committed
650 651 652 653 654 655 656 657
}

void
ConeAttributes::SetUpAxis(const double *upAxis_)
{
    upAxis[0] = upAxis_[0];
    upAxis[1] = upAxis_[1];
    upAxis[2] = upAxis_[2];
658
    Select(ID_upAxis, (void *)upAxis, 3);
hrchilds's avatar
hrchilds committed
659 660 661 662 663 664
}

void
ConeAttributes::SetCutByLength(bool cutByLength_)
{
    cutByLength = cutByLength_;
665
    Select(ID_cutByLength, (void *)&cutByLength);
hrchilds's avatar
hrchilds committed
666 667 668 669 670 671
}

void
ConeAttributes::SetLength(double length_)
{
    length = length_;
672
    Select(ID_length, (void *)&length);
hrchilds's avatar
hrchilds committed
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745
}

///////////////////////////////////////////////////////////////////////////////
// Get property methods
///////////////////////////////////////////////////////////////////////////////

double
ConeAttributes::GetAngle() const
{
    return angle;
}

const double *
ConeAttributes::GetOrigin() const
{
    return origin;
}

double *
ConeAttributes::GetOrigin()
{
    return origin;
}

const double *
ConeAttributes::GetNormal() const
{
    return normal;
}

double *
ConeAttributes::GetNormal()
{
    return normal;
}

ConeAttributes::Representation
ConeAttributes::GetRepresentation() const
{
    return Representation(representation);
}

const double *
ConeAttributes::GetUpAxis() const
{
    return upAxis;
}

double *
ConeAttributes::GetUpAxis()
{
    return upAxis;
}

bool
ConeAttributes::GetCutByLength() const
{
    return cutByLength;
}

double
ConeAttributes::GetLength() const
{
    return length;
}

///////////////////////////////////////////////////////////////////////////////
// Select property methods
///////////////////////////////////////////////////////////////////////////////

void
ConeAttributes::SelectOrigin()
{
746
    Select(ID_origin, (void *)origin, 3);
hrchilds's avatar
hrchilds committed
747 748 749 750 751
}

void
ConeAttributes::SelectNormal()
{
752
    Select(ID_normal, (void *)normal, 3);
hrchilds's avatar
hrchilds committed
753 754 755 756 757
}

void
ConeAttributes::SelectUpAxis()
{
758
    Select(ID_upAxis, (void *)upAxis, 3);
hrchilds's avatar
hrchilds committed
759 760 761 762 763 764 765 766 767 768 769 770 771 772 773
}

///////////////////////////////////////////////////////////////////////////////
// Keyframing methods
///////////////////////////////////////////////////////////////////////////////

// ****************************************************************************
// Method: ConeAttributes::GetFieldName
//
// Purpose: 
//   This method returns the name of a field given its index.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
774
// Creation:   omitted
hrchilds's avatar
hrchilds committed
775 776 777 778 779 780 781 782 783 784
//
// Modifications:
//   
// ****************************************************************************

std::string
ConeAttributes::GetFieldName(int index) const
{
    switch (index)
    {
785 786 787 788 789 790 791 792
    case ID_angle:          return "angle";
    case ID_origin:         return "origin";
    case ID_normal:         return "normal";
    case ID_representation: return "representation";
    case ID_upAxis:         return "upAxis";
    case ID_cutByLength:    return "cutByLength";
    case ID_length:         return "length";
    default:  return "invalid index";
hrchilds's avatar
hrchilds committed
793 794 795 796 797 798 799 800 801 802 803 804
    }
}

// ****************************************************************************
// Method: ConeAttributes::GetFieldType
//
// Purpose: 
//   This method returns the type of a field given its index.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
805
// Creation:   omitted
hrchilds's avatar
hrchilds committed
806 807 808 809 810 811 812 813 814 815
//
// Modifications:
//   
// ****************************************************************************

AttributeGroup::FieldType
ConeAttributes::GetFieldType(int index) const
{
    switch (index)
    {
816 817 818 819 820 821 822 823
    case ID_angle:          return FieldType_double;
    case ID_origin:         return FieldType_doubleArray;
    case ID_normal:         return FieldType_doubleArray;
    case ID_representation: return FieldType_enum;
    case ID_upAxis:         return FieldType_doubleArray;
    case ID_cutByLength:    return FieldType_bool;
    case ID_length:         return FieldType_double;
    default:  return FieldType_unknown;
hrchilds's avatar
hrchilds committed
824 825 826 827 828 829 830 831 832 833 834 835
    }
}

// ****************************************************************************
// Method: ConeAttributes::GetFieldTypeName
//
// Purpose: 
//   This method returns the name of a field type given its index.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
836
// Creation:   omitted
hrchilds's avatar
hrchilds committed
837 838 839 840 841 842 843 844 845 846
//
// Modifications:
//   
// ****************************************************************************

std::string
ConeAttributes::GetFieldTypeName(int index) const
{
    switch (index)
    {
847 848 849 850 851 852 853 854
    case ID_angle:          return "double";
    case ID_origin:         return "doubleArray";
    case ID_normal:         return "doubleArray";
    case ID_representation: return "enum";
    case ID_upAxis:         return "doubleArray";
    case ID_cutByLength:    return "bool";
    case ID_length:         return "double";
    default:  return "invalid index";
hrchilds's avatar
hrchilds committed
855 856 857 858 859 860 861 862 863 864 865 866
    }
}

// ****************************************************************************
// Method: ConeAttributes::FieldsEqual
//
// Purpose: 
//   This method compares two fields and return true if they are equal.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
867
// Creation:   omitted
hrchilds's avatar
hrchilds committed
868 869 870 871 872 873 874 875 876 877 878 879
//
// Modifications:
//   
// ****************************************************************************

bool
ConeAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
{
    const ConeAttributes &obj = *((const ConeAttributes*)rhs);
    bool retval = false;
    switch (index_)
    {
880
    case ID_angle:
hrchilds's avatar
hrchilds committed
881 882 883 884
        {  // new scope
        retval = (angle == obj.angle);
        }
        break;
885
    case ID_origin:
hrchilds's avatar
hrchilds committed
886 887 888
        {  // new scope
        // Compare the origin arrays.
        bool origin_equal = true;
889
        for(int i = 0; i < 3 && origin_equal; ++i)
hrchilds's avatar
hrchilds committed
890 891 892 893 894
            origin_equal = (origin[i] == obj.origin[i]);

        retval = origin_equal;
        }
        break;
895
    case ID_normal:
hrchilds's avatar
hrchilds committed
896 897 898
        {  // new scope
        // Compare the normal arrays.
        bool normal_equal = true;
899
        for(int i = 0; i < 3 && normal_equal; ++i)
hrchilds's avatar
hrchilds committed
900 901 902 903 904
            normal_equal = (normal[i] == obj.normal[i]);

        retval = normal_equal;
        }
        break;
905
    case ID_representation:
hrchilds's avatar
hrchilds committed
906 907 908 909
        {  // new scope
        retval = (representation == obj.representation);
        }
        break;
910
    case ID_upAxis:
hrchilds's avatar
hrchilds committed
911 912 913
        {  // new scope
        // Compare the upAxis arrays.
        bool upAxis_equal = true;
914
        for(int i = 0; i < 3 && upAxis_equal; ++i)
hrchilds's avatar
hrchilds committed
915 916 917 918 919
            upAxis_equal = (upAxis[i] == obj.upAxis[i]);

        retval = upAxis_equal;
        }
        break;
920
    case ID_cutByLength:
hrchilds's avatar
hrchilds committed
921 922 923 924
        {  // new scope
        retval = (cutByLength == obj.cutByLength);
        }
        break;
925
    case ID_length:
hrchilds's avatar
hrchilds committed
926 927 928 929 930 931 932 933 934 935 936 937 938 939
        {  // new scope
        retval = (length == obj.length);
        }
        break;
    default: retval = false;
    }

    return retval;
}

///////////////////////////////////////////////////////////////////////////////
// User-defined methods.
///////////////////////////////////////////////////////////////////////////////