1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 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 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 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 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 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 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 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 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074
|
/*****************************************************************************
*
* Copyright (c) 2000 - 2017, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* 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
* 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
* 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
* 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
* 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.
*
*****************************************************************************/
#include <Line.h>
#include <DataNode.h>
// ****************************************************************************
// Method: Line::Line
//
// Purpose:
// Init utility for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
void Line::Init()
{
point1[0] = 0;
point1[1] = 0;
point1[2] = 0;
point2[0] = 1;
point2[1] = 1;
point2[2] = 1;
lineStyle = 0;
lineWidth = 0;
interactive = false;
reflineLabels = false;
varName = "default";
samplingOn = false;
numSamples = 50;
Line::SelectAll();
}
// ****************************************************************************
// Method: Line::Line
//
// Purpose:
// Copy utility for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
void Line::Copy(const Line &obj)
{
point1[0] = obj.point1[0];
point1[1] = obj.point1[1];
point1[2] = obj.point1[2];
point2[0] = obj.point2[0];
point2[1] = obj.point2[1];
point2[2] = obj.point2[2];
designator = obj.designator;
color = obj.color;
lineStyle = obj.lineStyle;
lineWidth = obj.lineWidth;
interactive = obj.interactive;
reflineLabels = obj.reflineLabels;
varName = obj.varName;
samplingOn = obj.samplingOn;
numSamples = obj.numSamples;
Line::SelectAll();
}
// Type map format string
const char *Line::TypeMapFormatString = LINE_TMFS;
const AttributeGroup::private_tmfs_t Line::TmfsStruct = {LINE_TMFS};
// ****************************************************************************
// Method: Line::Line
//
// Purpose:
// Default constructor for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
Line::Line() :
AttributeSubject(Line::TypeMapFormatString),
color(0, 0, 0)
{
Line::Init();
}
// ****************************************************************************
// Method: Line::Line
//
// Purpose:
// Constructor for the derived classes of Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
Line::Line(private_tmfs_t tmfs) :
AttributeSubject(tmfs.tmfs),
color(0, 0, 0)
{
Line::Init();
}
// ****************************************************************************
// Method: Line::Line
//
// Purpose:
// Copy constructor for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
Line::Line(const Line &obj) :
AttributeSubject(Line::TypeMapFormatString)
{
Line::Copy(obj);
}
// ****************************************************************************
// Method: Line::Line
//
// Purpose:
// Copy constructor for derived classes of the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
Line::Line(const Line &obj, private_tmfs_t tmfs) :
AttributeSubject(tmfs.tmfs)
{
Line::Copy(obj);
}
// ****************************************************************************
// Method: Line::~Line
//
// Purpose:
// Destructor for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
Line::~Line()
{
// nothing here
}
// ****************************************************************************
// Method: Line::operator =
//
// Purpose:
// Assignment operator for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
Line&
Line::operator = (const Line &obj)
{
if (this == &obj) return *this;
Line::Copy(obj);
return *this;
}
// ****************************************************************************
// Method: Line::operator ==
//
// Purpose:
// Comparison operator == for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
bool
Line::operator == (const Line &obj) const
{
// Compare the point1 arrays.
bool point1_equal = true;
for(int i = 0; i < 3 && point1_equal; ++i)
point1_equal = (point1[i] == obj.point1[i]);
// Compare the point2 arrays.
bool point2_equal = true;
for(int i = 0; i < 3 && point2_equal; ++i)
point2_equal = (point2[i] == obj.point2[i]);
// Create the return value
return (point1_equal &&
point2_equal &&
(designator == obj.designator) &&
(color == obj.color) &&
(lineStyle == obj.lineStyle) &&
(lineWidth == obj.lineWidth) &&
(interactive == obj.interactive) &&
(reflineLabels == obj.reflineLabels) &&
(varName == obj.varName) &&
(samplingOn == obj.samplingOn) &&
(numSamples == obj.numSamples));
}
// ****************************************************************************
// Method: Line::operator !=
//
// Purpose:
// Comparison operator != for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
bool
Line::operator != (const Line &obj) const
{
return !(this->operator == (obj));
}
// ****************************************************************************
// Method: Line::TypeName
//
// Purpose:
// Type name method for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
const std::string
Line::TypeName() const
{
return "Line";
}
// ****************************************************************************
// Method: Line::CopyAttributes
//
// Purpose:
// CopyAttributes method for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
bool
Line::CopyAttributes(const AttributeGroup *atts)
{
if(TypeName() != atts->TypeName())
return false;
// Call assignment operator.
const Line *tmp = (const Line *)atts;
*this = *tmp;
return true;
}
// ****************************************************************************
// Method: Line::CreateCompatible
//
// Purpose:
// CreateCompatible method for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
AttributeSubject *
Line::CreateCompatible(const std::string &tname) const
{
AttributeSubject *retval = 0;
if(TypeName() == tname)
retval = new Line(*this);
// Other cases could go here too.
return retval;
}
// ****************************************************************************
// Method: Line::NewInstance
//
// Purpose:
// NewInstance method for the Line class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
AttributeSubject *
Line::NewInstance(bool copy) const
{
AttributeSubject *retval = 0;
if(copy)
retval = new Line(*this);
else
retval = new Line;
return retval;
}
// ****************************************************************************
// Method: Line::SelectAll
//
// Purpose:
// Selects all attributes.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
void
Line::SelectAll()
{
Select(ID_point1, (void *)point1, 3);
Select(ID_point2, (void *)point2, 3);
Select(ID_designator, (void *)&designator);
Select(ID_color, (void *)&color);
Select(ID_lineStyle, (void *)&lineStyle);
Select(ID_lineWidth, (void *)&lineWidth);
Select(ID_interactive, (void *)&interactive);
Select(ID_reflineLabels, (void *)&reflineLabels);
Select(ID_varName, (void *)&varName);
Select(ID_samplingOn, (void *)&samplingOn);
Select(ID_numSamples, (void *)&numSamples);
}
///////////////////////////////////////////////////////////////////////////////
// Persistence methods
///////////////////////////////////////////////////////////////////////////////
// ****************************************************************************
// Method: Line::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
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
bool
Line::CreateNode(DataNode *parentNode, bool completeSave, bool forceAdd)
{
if(parentNode == 0)
return false;
Line defaultObject;
bool addToParent = false;
// Create a node for Line.
DataNode *node = new DataNode("Line");
if(completeSave || !FieldsEqual(ID_point1, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("point1", point1, 3));
}
if(completeSave || !FieldsEqual(ID_point2, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("point2", point2, 3));
}
if(completeSave || !FieldsEqual(ID_designator, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("designator", designator));
}
DataNode *colorNode = new DataNode("color");
if(color.CreateNode(colorNode, completeSave, true))
{
addToParent = true;
node->AddNode(colorNode);
}
else
delete colorNode;
if(completeSave || !FieldsEqual(ID_lineStyle, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("lineStyle", lineStyle));
}
if(completeSave || !FieldsEqual(ID_lineWidth, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("lineWidth", lineWidth));
}
if(completeSave || !FieldsEqual(ID_interactive, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("interactive", interactive));
}
if(completeSave || !FieldsEqual(ID_reflineLabels, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("reflineLabels", reflineLabels));
}
if(completeSave || !FieldsEqual(ID_varName, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("varName", varName));
}
if(completeSave || !FieldsEqual(ID_samplingOn, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("samplingOn", samplingOn));
}
if(completeSave || !FieldsEqual(ID_numSamples, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("numSamples", numSamples));
}
// Add the node to the parent node.
if(addToParent || forceAdd)
parentNode->AddNode(node);
else
delete node;
return (addToParent || forceAdd);
}
// ****************************************************************************
// Method: Line::SetFromNode
//
// Purpose:
// This method sets attributes in this object from values in a DataNode representation of the object.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
void
Line::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("Line");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("point1")) != 0)
SetPoint1(node->AsDoubleArray());
if((node = searchNode->GetNode("point2")) != 0)
SetPoint2(node->AsDoubleArray());
if((node = searchNode->GetNode("designator")) != 0)
SetDesignator(node->AsString());
if((node = searchNode->GetNode("color")) != 0)
color.SetFromNode(node);
if((node = searchNode->GetNode("lineStyle")) != 0)
SetLineStyle(node->AsInt());
if((node = searchNode->GetNode("lineWidth")) != 0)
SetLineWidth(node->AsInt());
if((node = searchNode->GetNode("interactive")) != 0)
SetInteractive(node->AsBool());
if((node = searchNode->GetNode("reflineLabels")) != 0)
SetReflineLabels(node->AsBool());
if((node = searchNode->GetNode("varName")) != 0)
SetVarName(node->AsString());
if((node = searchNode->GetNode("samplingOn")) != 0)
SetSamplingOn(node->AsBool());
if((node = searchNode->GetNode("numSamples")) != 0)
SetNumSamples(node->AsInt());
}
///////////////////////////////////////////////////////////////////////////////
// Set property methods
///////////////////////////////////////////////////////////////////////////////
void
Line::SetPoint1(const double *point1_)
{
point1[0] = point1_[0];
point1[1] = point1_[1];
point1[2] = point1_[2];
Select(ID_point1, (void *)point1, 3);
}
void
Line::SetPoint2(const double *point2_)
{
point2[0] = point2_[0];
point2[1] = point2_[1];
point2[2] = point2_[2];
Select(ID_point2, (void *)point2, 3);
}
void
Line::SetDesignator(const std::string &designator_)
{
designator = designator_;
Select(ID_designator, (void *)&designator);
}
void
Line::SetColor(const ColorAttribute &color_)
{
color = color_;
Select(ID_color, (void *)&color);
}
void
Line::SetLineStyle(int lineStyle_)
{
lineStyle = lineStyle_;
Select(ID_lineStyle, (void *)&lineStyle);
}
void
Line::SetLineWidth(int lineWidth_)
{
lineWidth = lineWidth_;
Select(ID_lineWidth, (void *)&lineWidth);
}
void
Line::SetInteractive(bool interactive_)
{
interactive = interactive_;
Select(ID_interactive, (void *)&interactive);
}
void
Line::SetReflineLabels(bool reflineLabels_)
{
reflineLabels = reflineLabels_;
Select(ID_reflineLabels, (void *)&reflineLabels);
}
void
Line::SetVarName(const std::string &varName_)
{
varName = varName_;
Select(ID_varName, (void *)&varName);
}
void
Line::SetSamplingOn(bool samplingOn_)
{
samplingOn = samplingOn_;
Select(ID_samplingOn, (void *)&samplingOn);
}
void
Line::SetNumSamples(int numSamples_)
{
numSamples = numSamples_;
Select(ID_numSamples, (void *)&numSamples);
}
///////////////////////////////////////////////////////////////////////////////
// Get property methods
///////////////////////////////////////////////////////////////////////////////
const double *
Line::GetPoint1() const
{
return point1;
}
double *
Line::GetPoint1()
{
return point1;
}
const double *
Line::GetPoint2() const
{
return point2;
}
double *
Line::GetPoint2()
{
return point2;
}
const std::string &
Line::GetDesignator() const
{
return designator;
}
std::string &
Line::GetDesignator()
{
return designator;
}
const ColorAttribute &
Line::GetColor() const
{
return color;
}
ColorAttribute &
Line::GetColor()
{
return color;
}
int
Line::GetLineStyle() const
{
return lineStyle;
}
int
Line::GetLineWidth() const
{
return lineWidth;
}
bool
Line::GetInteractive() const
{
return interactive;
}
bool
Line::GetReflineLabels() const
{
return reflineLabels;
}
const std::string &
Line::GetVarName() const
{
return varName;
}
std::string &
Line::GetVarName()
{
return varName;
}
bool
Line::GetSamplingOn() const
{
return samplingOn;
}
int
Line::GetNumSamples() const
{
return numSamples;
}
///////////////////////////////////////////////////////////////////////////////
// Select property methods
///////////////////////////////////////////////////////////////////////////////
void
Line::SelectPoint1()
{
Select(ID_point1, (void *)point1, 3);
}
void
Line::SelectPoint2()
{
Select(ID_point2, (void *)point2, 3);
}
void
Line::SelectDesignator()
{
Select(ID_designator, (void *)&designator);
}
void
Line::SelectColor()
{
Select(ID_color, (void *)&color);
}
void
Line::SelectVarName()
{
Select(ID_varName, (void *)&varName);
}
///////////////////////////////////////////////////////////////////////////////
// Keyframing methods
///////////////////////////////////////////////////////////////////////////////
// ****************************************************************************
// Method: Line::GetFieldName
//
// Purpose:
// This method returns the name of a field given its index.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
std::string
Line::GetFieldName(int index) const
{
switch (index)
{
case ID_point1: return "point1";
case ID_point2: return "point2";
case ID_designator: return "designator";
case ID_color: return "color";
case ID_lineStyle: return "lineStyle";
case ID_lineWidth: return "lineWidth";
case ID_interactive: return "interactive";
case ID_reflineLabels: return "reflineLabels";
case ID_varName: return "varName";
case ID_samplingOn: return "samplingOn";
case ID_numSamples: return "numSamples";
default: return "invalid index";
}
}
// ****************************************************************************
// Method: Line::GetFieldType
//
// Purpose:
// This method returns the type of a field given its index.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
AttributeGroup::FieldType
Line::GetFieldType(int index) const
{
switch (index)
{
case ID_point1: return FieldType_doubleArray;
case ID_point2: return FieldType_doubleArray;
case ID_designator: return FieldType_string;
case ID_color: return FieldType_color;
case ID_lineStyle: return FieldType_linestyle;
case ID_lineWidth: return FieldType_linewidth;
case ID_interactive: return FieldType_bool;
case ID_reflineLabels: return FieldType_bool;
case ID_varName: return FieldType_string;
case ID_samplingOn: return FieldType_bool;
case ID_numSamples: return FieldType_int;
default: return FieldType_unknown;
}
}
// ****************************************************************************
// Method: Line::GetFieldTypeName
//
// Purpose:
// This method returns the name of a field type given its index.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
std::string
Line::GetFieldTypeName(int index) const
{
switch (index)
{
case ID_point1: return "doubleArray";
case ID_point2: return "doubleArray";
case ID_designator: return "string";
case ID_color: return "color";
case ID_lineStyle: return "linestyle";
case ID_lineWidth: return "linewidth";
case ID_interactive: return "bool";
case ID_reflineLabels: return "bool";
case ID_varName: return "string";
case ID_samplingOn: return "bool";
case ID_numSamples: return "int";
default: return "invalid index";
}
}
// ****************************************************************************
// Method: Line::FieldsEqual
//
// Purpose:
// This method compares two fields and return true if they are equal.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
bool
Line::FieldsEqual(int index_, const AttributeGroup *rhs) const
{
const Line &obj = *((const Line*)rhs);
bool retval = false;
switch (index_)
{
case ID_point1:
{ // new scope
// Compare the point1 arrays.
bool point1_equal = true;
for(int i = 0; i < 3 && point1_equal; ++i)
point1_equal = (point1[i] == obj.point1[i]);
retval = point1_equal;
}
break;
case ID_point2:
{ // new scope
// Compare the point2 arrays.
bool point2_equal = true;
for(int i = 0; i < 3 && point2_equal; ++i)
point2_equal = (point2[i] == obj.point2[i]);
retval = point2_equal;
}
break;
case ID_designator:
{ // new scope
retval = (designator == obj.designator);
}
break;
case ID_color:
{ // new scope
retval = (color == obj.color);
}
break;
case ID_lineStyle:
{ // new scope
retval = (lineStyle == obj.lineStyle);
}
break;
case ID_lineWidth:
{ // new scope
retval = (lineWidth == obj.lineWidth);
}
break;
case ID_interactive:
{ // new scope
retval = (interactive == obj.interactive);
}
break;
case ID_reflineLabels:
{ // new scope
retval = (reflineLabels == obj.reflineLabels);
}
break;
case ID_varName:
{ // new scope
retval = (varName == obj.varName);
}
break;
case ID_samplingOn:
{ // new scope
retval = (samplingOn == obj.samplingOn);
}
break;
case ID_numSamples:
{ // new scope
retval = (numSamples == obj.numSamples);
}
break;
default: retval = false;
}
return retval;
}
///////////////////////////////////////////////////////////////////////////////
// User-defined methods.
///////////////////////////////////////////////////////////////////////////////
// ****************************************************************************
// Method: Line::SetPoint1
//
// Purpose:
// A method to set the xyz values of point1.
//
// Arguments:
// x,y,z the coordinate
//
// Programmer: Kathleen Bonnell
// Creation: February 28, 2003
//
// ****************************************************************************
void
Line::SetPoint1(double x, double y, double z)
{
point1[0] = x;
point1[1] = y;
point1[2] = z;
Select(0, (void*)point1, 3);
}
// ****************************************************************************
// Method: Line::SetPoint2
//
// Purpose:
// A method to set the xyz values of point2.
//
// Arguments:
// x,y,z the coordinate
//
// Programmer: Kathleen Bonnell
// Creation: February 28, 2003
//
// ****************************************************************************
void
Line::SetPoint2(double x, double y, double z)
{
point2[0] = x;
point2[1] = y;
point2[2] = z;
Select(1, (void*)point2, 3);
}
|