0030991: Draw Harness - ViewerTest::ParseColor() defines out-of-range alpha component
[occt.git] / src / XDEDRAW / XDEDRAW_Colors.cxx
CommitLineData
fcd9a94e 1// Created on: 2000-08-04
b311480e 2// Created by: Pavel TELKOV
973c2be1 3// Copyright (c) 2000-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
7fd59977 16
17#include <DBRep.hxx>
18#include <DDocStd.hxx>
42cf5bc1 19#include <Draw.hxx>
973d410e 20#include <Precision.hxx>
7fd59977 21#include <Quantity_Color.hxx>
973d410e 22#include <Quantity_ColorRGBA.hxx>
42cf5bc1 23#include <TCollection_AsciiString.hxx>
7fd59977 24#include <TDF_Label.hxx>
25#include <TDF_LabelSequence.hxx>
42cf5bc1 26#include <TDF_Tool.hxx>
7fd59977 27#include <TDocStd_Document.hxx>
42cf5bc1 28#include <TopoDS_Shape.hxx>
9196ea9d 29#include <ViewerTest.hxx>
42cf5bc1 30#include <XCAFDoc_ColorTool.hxx>
7fd59977 31#include <XCAFDoc_DocumentTool.hxx>
32#include <XCAFDoc_ShapeTool.hxx>
42cf5bc1 33#include <XDEDRAW_Colors.hxx>
7fd59977 34
9196ea9d 35//! Parse XCAFDoc_ColorType enumeration argument.
36static bool parseXDocColorType (const TCollection_AsciiString& theArg,
37 XCAFDoc_ColorType& theType)
38{
39 TCollection_AsciiString anArgCase (theArg);
40 anArgCase.LowerCase();
41 if (anArgCase == "surf"
42 || anArgCase == "surface"
43 || anArgCase == "s")
44 {
45 theType = XCAFDoc_ColorSurf;
46 return true;
47 }
48 else if (anArgCase == "curve"
49 || anArgCase == "c")
50 {
51 theType = XCAFDoc_ColorCurv;
52 return true;
53 }
54 else if (anArgCase == "gen"
55 || anArgCase == "generic")
56 {
57 theType = XCAFDoc_ColorGen;
58 return true;
59 }
60 return false;
61}
62
7fd59977 63//=======================================================================
64// Section: Work with colors
65//=======================================================================
9196ea9d 66static Standard_Integer setColor (Draw_Interpretor& , Standard_Integer argc, const char** argv)
7fd59977 67{
9196ea9d 68 if (argc < 4)
69 {
70 std::cout << "Syntax error: wrong number of arguments\n";
7fd59977 71 return 1;
72 }
973d410e 73
9196ea9d 74 Handle(TDocStd_Document) aDoc;
75 DDocStd::GetDocument (argv[1], aDoc);
76 if (aDoc.IsNull())
77 {
78 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
79 return 1;
973d410e 80 }
9196ea9d 81
82 TDF_Label aLabel;
83 TopoDS_Shape aShape;
84 TDF_Tool::Label (aDoc->GetData(), argv[2], aLabel);
85 if (aLabel.IsNull())
86 {
87 aShape = DBRep::Get (argv[2]);
88 if (aShape.IsNull())
89 {
90 std::cout << "Syntax error: " << argv[2] << " is not a label nor shape\n";
91 return 1;
92 }
93 }
94
95 Quantity_ColorRGBA aColor;
96 bool isColorDefined = false;
97 XCAFDoc_ColorType aColType = XCAFDoc_ColorGen;
98 for (Standard_Integer anArgIter = 3; anArgIter < argc; ++anArgIter)
99 {
100 if (parseXDocColorType (argv[anArgIter], aColType))
101 {
102 //
103 }
104 else if (!isColorDefined)
105 {
106 isColorDefined = true;
107 Standard_Integer aNbParsed = ViewerTest::ParseColor (argc - anArgIter,
108 argv + anArgIter,
109 aColor);
110 if (aNbParsed == 0)
111 {
112 std::cout << "Syntax error at '" << argv[anArgIter] << "'\n";
113 return 1;
114 }
115 anArgIter += aNbParsed - 1;
116 }
117 else
118 {
119 std::cout << "Syntax error at '" << argv[anArgIter] << "'\n";
120 return 1;
7fd59977 121 }
122 }
9196ea9d 123 if (!isColorDefined)
124 {
125 std::cout << "Syntax error: wrong number of arguments\n";
126 return 1;
127 }
128
129 Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
130 if (!aLabel.IsNull())
131 {
132 aColorTool->SetColor (aLabel, aColor, aColType);
133 }
134 else if (!aColorTool->SetColor (aShape, aColor, aColType))
135 {
136 std::cout << "Syntax error: " << argv[2] << " is not a label nor shape\n";
137 return 1;
138 }
7fd59977 139 return 0;
140}
141
142static Standard_Integer getColor (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
143{
9196ea9d 144 if (argc != 3)
145 {
146 std::cout << "Syntax error: wrong number of arguments\n";
147 return 1;
148 }
149
150 Handle(TDocStd_Document) aDoc;
151 DDocStd::GetDocument (argv[1], aDoc);
152 if (aDoc.IsNull())
153 {
154 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
7fd59977 155 return 1;
156 }
7fd59977 157
158 TDF_Label aLabel;
9196ea9d 159 TDF_Tool::Label (aDoc->GetData(), argv[2], aLabel);
160 Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
161 Quantity_ColorRGBA aColor;
162 if (!myColors->GetColor (aLabel, aColor))
163 {
164 return 0;
165 }
166
167 if ((1.0 - aColor.Alpha()) < Precision::Confusion())
168 {
169 di << aColor.GetRGB().StringName (aColor.GetRGB().Name());
170 }
973d410e 171 else
9196ea9d 172 {
173 di << aColor.GetRGB().StringName (aColor.GetRGB().Name()) << " (" << aColor.Alpha() << ")";
174 }
7fd59977 175 return 0;
176}
177
178static Standard_Integer getShapeColor (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
179{
9196ea9d 180 if (argc != 3 && argc != 4)
181 {
182 std::cout << "Syntax error: wrong number of arguments\n";
183 return 1;
184 }
185
186 Handle(TDocStd_Document) aDoc;
187 DDocStd::GetDocument (argv[1], aDoc);
188 if (aDoc.IsNull())
189 {
190 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
7fd59977 191 return 1;
192 }
7fd59977 193
194 TDF_Label aLabel;
9196ea9d 195 TDF_Tool::Label (aDoc->GetData(), argv[2], aLabel);
196 if (aLabel.IsNull())
197 {
198 std::cout << "Syntax error: '" << argv[2] << "' label is not found in the document\n";
3c946c38 199 return 1;
200 }
201
9196ea9d 202 Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
203 XCAFDoc_ColorType aColType = XCAFDoc_ColorGen;
204 if (argc > 3 && !parseXDocColorType (argv[3], aColType))
205 {
206 std::cout << "Syntax error: unknown color type '" << argv[3] << "'\n";
207 return 1;
208 }
3c946c38 209
9196ea9d 210 Quantity_ColorRGBA aColor;
211 if (!myColors->GetColor (aLabel, aColType, aColor))
212 {
213 return 0;
214 }
3c946c38 215
9196ea9d 216 if ((1.0 - aColor.Alpha()) < Precision::Confusion())
217 {
218 di << aColor.GetRGB().StringName(aColor.GetRGB().Name());
219 }
973d410e 220 else
9196ea9d 221 {
222 di << aColor.GetRGB().StringName(aColor.GetRGB().Name()) << " (" << aColor.Alpha() << ")";
223 }
3c946c38 224
7fd59977 225 return 0;
226}
227
228static Standard_Integer getAllColors (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
229{
9196ea9d 230 if (argc != 2)
231 {
232 std::cout << "Syntax error: wrong number of arguments\n";
7fd59977 233 return 1;
234 }
7fd59977 235
9196ea9d 236 Handle(TDocStd_Document) aDoc;
237 DDocStd::GetDocument (argv[1], aDoc);
238 if (aDoc.IsNull())
239 {
240 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
241 return 1;
242 }
243
244 Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
245 TDF_LabelSequence aLabels;
246 aColorTool->GetColors (aLabels);
247 if (aLabels.Length() >= 1)
248 {
249 for (TDF_LabelSequence::Iterator aLabIter (aLabels); aLabIter.More(); aLabIter.Next())
250 {
251 Quantity_ColorRGBA aColor;
252 if (!aColorTool->GetColor (aLabIter.Value(), aColor))
253 {
254 continue;
255 }
256 if ((1.0 - aColor.Alpha()) < Precision::Confusion())
257 {
258 di << aColor.GetRGB().StringName (aColor.GetRGB().Name());
259 }
973d410e 260 else
9196ea9d 261 {
262 di << aColor.GetRGB().StringName (aColor.GetRGB().Name()) << " (" << aColor.Alpha() << ")";
263 }
7fd59977 264 di << " ";
265 }
266 }
267 return 0;
268}
269
270
271static Standard_Integer addColor (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
272{
9196ea9d 273 if (argc < 3)
274 {
275 std::cout << "Syntax error: wrong number of arguments\n";
7fd59977 276 return 1;
277 }
7fd59977 278
9196ea9d 279 Handle(TDocStd_Document) aDoc;
280 DDocStd::GetDocument (argv[1], aDoc);
281 if (aDoc.IsNull())
282 {
283 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
284 return 1;
285 }
7fd59977 286
9196ea9d 287 Quantity_ColorRGBA aColRGBA;
288 Standard_Integer aNbParsed = ViewerTest::ParseColor (argc - 2, argv + 2, aColRGBA);
289 if (aNbParsed != argc - 2)
290 {
291 std::cout << "Syntax error at '" << argv[2] << "'\n";
292 return 1;
973d410e 293 }
9196ea9d 294
295 TCollection_AsciiString anEntry;
296 Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
297 TDF_Label aLabel = aColorTool->AddColor (aColRGBA);
298 TDF_Tool::Entry (aLabel, anEntry);
299 di << anEntry;
7fd59977 300 return 0;
301}
302
9196ea9d 303static Standard_Integer removeColor (Draw_Interpretor& , Standard_Integer argc, const char** argv)
7fd59977 304{
9196ea9d 305 if (argc != 3)
306 {
307 std::cout << "Syntax error: wrong number of arguments\n";
7fd59977 308 return 1;
309 }
7fd59977 310
9196ea9d 311 Handle(TDocStd_Document) aDoc;
7fd59977 312 TDF_Label aLabel;
9196ea9d 313 DDocStd::GetDocument (argv[1], aDoc);
314 if (aDoc.IsNull())
315 {
316 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
317 return 1;
318 }
319 TDF_Tool::Label (aDoc->GetData(), argv[2], aLabel);
320 if (aLabel.IsNull())
321 {
322 std::cout << "Syntax error: " << argv[2] << " label is not found in the document\n";
323 return 1;
324 }
325
326 Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
327 aColorTool->RemoveColor (aLabel);
7fd59977 328 return 0;
329}
330
331static Standard_Integer findColor (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
332{
9196ea9d 333 if (argc < 3)
334 {
335 std::cout << "Syntax error: wrong number of arguments\n";
7fd59977 336 return 1;
337 }
7fd59977 338
9196ea9d 339 Handle(TDocStd_Document) aDoc;
340 DDocStd::GetDocument (argv[1], aDoc);
341 if (aDoc.IsNull())
342 {
343 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
344 return 1;
973d410e 345 }
9196ea9d 346
347 Quantity_ColorRGBA aColRGBA;
348 Standard_Integer aNbParsed = ViewerTest::ParseColor (argc - 2, argv + 2, aColRGBA);
349 if (aNbParsed != argc - 2)
350 {
351 std::cout << "Syntax error at '" << argv[2] << "'\n";
352 return 1;
973d410e 353 }
9196ea9d 354
355 Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
356 TCollection_AsciiString anEntry;
357 TDF_Tool::Entry (aColorTool->FindColor (aColRGBA), anEntry);
358 di << anEntry;
7fd59977 359 return 0;
360}
361
9196ea9d 362static Standard_Integer unsetColor (Draw_Interpretor& , Standard_Integer argc, const char** argv)
7fd59977 363{
9196ea9d 364 if (argc != 4)
365 {
366 std::cout << "Syntax error: wrong number of arguments\n";
367 return 1;
368 }
369
370 Handle(TDocStd_Document) aDoc;
371 DDocStd::GetDocument (argv[1], aDoc);
372 if (aDoc.IsNull())
373 {
374 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
375 return 1;
376 }
377
378 XCAFDoc_ColorType aColType = XCAFDoc_ColorGen;
379 if (!parseXDocColorType (argv[3], aColType))
380 {
381 std::cout << "Syntax error: unknown color type '" << argv[3] << "'\n";
7fd59977 382 return 1;
383 }
7fd59977 384
385 TDF_Label aLabel;
9196ea9d 386 TDF_Tool::Label (aDoc->GetData(), argv[2], aLabel);
387 Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
388 if (!aLabel.IsNull())
389 {
390 myColors->UnSetColor (aLabel, aColType);
391 return 0;
7fd59977 392 }
9196ea9d 393
394 TopoDS_Shape aShape = DBRep::Get (argv[2]);
395 if (aShape.IsNull())
396 {
397 std::cout << "Syntax error: " << argv[2] << " is not a label nor shape\n";
398 return 1;
7fd59977 399 }
9196ea9d 400 myColors->UnSetColor (aShape, aColType);
7fd59977 401 return 0;
402}
403
9196ea9d 404static Standard_Integer setVisibility (Draw_Interpretor& , Standard_Integer argc, const char** argv)
7fd59977 405{
9196ea9d 406 if (argc != 3 && argc != 4)
407 {
408 std::cout << "Syntax error: wrong number of arguments\n";
7fd59977 409 return 1;
410 }
9196ea9d 411
412 Handle(TDocStd_Document) aDoc;
7fd59977 413 TDF_Label aLabel;
9196ea9d 414 DDocStd::GetDocument (argv[1], aDoc);
415 if (aDoc.IsNull())
416 {
417 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
418 return 1;
419 }
420
421 TDF_Tool::Label (aDoc->GetData(), argv[2], aLabel);
422 Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
423 if (aLabel.IsNull())
424 {
7fd59977 425 // get label by shape
9196ea9d 426 TopoDS_Shape aShape = DBRep::Get (argv[2]);
427 if (!aShape.IsNull())
428 {
429 aLabel = aColorTool->ShapeTool()->FindShape (aShape, Standard_True);
7fd59977 430 }
431 }
9196ea9d 432 if (aLabel.IsNull())
433 {
434 std::cout << "Syntax error: " << argv[2] << " is not a label not shape\n";
7fd59977 435 return 1;
436 }
9196ea9d 437
438 Standard_Boolean isVisible = Standard_False;
439 if (argc == 4)
440 {
441 TCollection_AsciiString aVisArg (argv[3]);
442 if (aVisArg == "1")
443 {
444 isVisible = Standard_True;
445 }
446 else if (aVisArg == "0")
447 {
448 isVisible = Standard_False;
449 }
450 else
451 {
452 std::cout << "Syntax error: unknown argument '" << argv[3] << "'\n";
453 return 1;
454 }
455 }
456 aColorTool->SetVisibility (aLabel, isVisible);
7fd59977 457 return 0;
458}
459
460static Standard_Integer getVisibility (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
461{
9196ea9d 462 if (argc != 3)
463 {
464 std::cout << "Syntax error: wrong number of arguments\n";
465 return 1;
466 }
467
468 Handle(TDocStd_Document) aDoc;
469 DDocStd::GetDocument (argv[1], aDoc);
470 if (aDoc.IsNull())
471 {
472 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
7fd59977 473 return 1;
474 }
9196ea9d 475
476 Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
7fd59977 477 TDF_Label aLabel;
9196ea9d 478 TDF_Tool::Label (aDoc->GetData(), argv[2], aLabel);
479 if (aLabel.IsNull())
480 {
7fd59977 481 // get label by shape
9196ea9d 482 TopoDS_Shape aShape = DBRep::Get (argv[2]);
483 if (!aShape.IsNull())
484 {
485 aLabel = aColorTool->ShapeTool()->FindShape (aShape, Standard_True);
7fd59977 486 }
487 }
9196ea9d 488 if (aLabel.IsNull())
489 {
490 std::cout << "Syntax error: " << argv[2] << " is not a label not shape\n";
7fd59977 491 return 1;
492 }
9196ea9d 493
494 di << (aColorTool->IsVisible (aLabel) ? 1 : 0);
7fd59977 495 return 0;
496}
497
498static Standard_Integer getStyledVisibility (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
499{
9196ea9d 500 if (argc != 3)
501 {
502 std::cout << "Syntax error: wrong number of arguments\n";
7fd59977 503 return 1;
504 }
9196ea9d 505
506 Handle(TDocStd_Document) aDoc;
507 DDocStd::GetDocument (argv[1], aDoc);
508 TopoDS_Shape aShape = DBRep::Get(argv[2]);
509 if (aDoc.IsNull())
510 {
511 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
512 return 1;
513 }
514 if (aShape.IsNull())
515 {
516 std::cout << "Syntax error: " << argv[2] << " is not a shape\n";
517 return 1;
518 }
519
520 Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
521 di << (aColorTool->IsInstanceVisible (aShape) ? 1 : 0);
7fd59977 522 return 0;
523}
524
525static Standard_Integer getStyledcolor (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
526{
9196ea9d 527 if (argc != 3 && argc != 4)
528 {
529 std::cout << "Syntax error: wrong number of arguments\n";
7fd59977 530 return 1;
531 }
9196ea9d 532
533 Handle(TDocStd_Document) aDoc;
534 XCAFDoc_ColorType aColType = XCAFDoc_ColorGen;
535 DDocStd::GetDocument (argv[1], aDoc);
536 TopoDS_Shape aShape = DBRep::Get (argv[2]);
537 if (aDoc.IsNull())
538 {
539 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
540 return 1;
541 }
542 if (aShape.IsNull())
543 {
544 std::cout << "Syntax error: " << argv[2] << " is not a shape\n";
545 return 1;
546 }
547 if (argc > 3 && !parseXDocColorType (argv[3], aColType))
548 {
549 std::cout << "Syntax error: unknown color type '" << argv[3] << "'\n";
550 return 1;
551 }
552
553 Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
554 Quantity_ColorRGBA aColor;
555 if (aColorTool->GetInstanceColor (aShape, aColType, aColor))
7fd59977 556 {
9196ea9d 557 if ((1.0 - aColor.Alpha()) < Precision::Confusion())
558 {
559 di << aColor.GetRGB().StringName (aColor.GetRGB().Name());
560 }
973d410e 561 else
9196ea9d 562 {
563 di << aColor.GetRGB().StringName (aColor.GetRGB().Name()) << " (" << aColor.Alpha() << ")";
564 }
7fd59977 565 }
566 return 0;
567}
568
9196ea9d 569static Standard_Integer setStyledcolor (Draw_Interpretor& , Standard_Integer argc, const char** argv)
7fd59977 570{
9196ea9d 571 if (argc < 3)
572 {
573 std::cout << "Syntax error: wrong number of arguments\n";
7fd59977 574 return 1;
575 }
7fd59977 576
9196ea9d 577 Handle(TDocStd_Document) aDoc;
578 DDocStd::GetDocument (argv[1], aDoc);
579 if (aDoc.IsNull())
580 {
581 std::cout << "Syntax error: " << argv[1] << " is not a document\n";
582 return 1;
583 }
584
585 TopoDS_Shape aShape = DBRep::Get (argv[2]);
586 if (aShape.IsNull())
587 {
588 std::cout << "Syntax error: " << argv[2] << " is not a shape\n";
589 return 1;
973d410e 590 }
591
9196ea9d 592 XCAFDoc_ColorType aColorType = XCAFDoc_ColorGen;
593 Quantity_ColorRGBA aColRGBA;
594 for (Standard_Integer anArgIter = 3; anArgIter < argc; ++anArgIter)
595 {
596 if (parseXDocColorType (argv[anArgIter], aColorType))
597 {
598 //
599 }
600 else
601 {
602 Standard_Integer aNbParsed = ViewerTest::ParseColor (argc - anArgIter,
603 argv + anArgIter,
604 aColRGBA);
605 if (aNbParsed == 0)
606 {
607 std::cout << "Syntax error at '" << argv[anArgIter] << "'\n";
608 return 1;
609 }
610 anArgIter += aNbParsed - 1;
611 }
973d410e 612 }
9196ea9d 613
614 Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool (aDoc->Main());
615 if (!aColorTool->SetInstanceColor (aShape, aColorType, aColRGBA))
7fd59977 616 {
9196ea9d 617 std::cout << "Error: cannot set color for the indicated component\n";
7fd59977 618 return 1;
619 }
620 return 0;
621}
622
623//=======================================================================
624//function : InitCommands
625//purpose :
626//=======================================================================
627
628void XDEDRAW_Colors::InitCommands(Draw_Interpretor& di)
629{
7fd59977 630 static Standard_Boolean initactor = Standard_False;
c48e2889 631 if (initactor)
632 {
633 return;
634 }
635 initactor = Standard_True;
7fd59977 636
637 //=====================================
638 // Work with colors
639 //=====================================
640
641 Standard_CString g = "XDE color's commands";
9196ea9d 642
643 di.Add ("XSetColor","Doc {Label|Shape} R G B [alpha] [{generic|surface|curve}=gen]"
644 "\t: Set color [R G B] to shape given by Label, "
ec99ba32 645 "type of color 's' - for surface, 'c' - for curve (default generic)",
7fd59977 646 __FILE__, setColor, g);
647
9196ea9d 648 di.Add ("XGetColor","Doc label"
649 "\t: Return color defined on label in colortable",
7fd59977 650 __FILE__, getColor, g);
651
9196ea9d 652 di.Add ("XGetShapeColor","Doc Label {generic|surface|curve}"
653 "\t: Returns color defined by label",
7fd59977 654 __FILE__, getShapeColor, g);
9196ea9d 655
656 di.Add ("XGetAllColors","Doc"
657 "\t: Print all colors that defined in document",
7fd59977 658 __FILE__, getAllColors, g);
659
9196ea9d 660 di.Add ("XAddColor","Doc R G B [alpha]"
661 "\t: Add color in document to color table",
7fd59977 662 __FILE__, addColor, g);
663
9196ea9d 664 di.Add ("XRemoveColor","Doc Label"
665 "\t: Remove color in document from color table",
7fd59977 666 __FILE__, removeColor, g);
667
9196ea9d 668 di.Add ("XFindColor","Doc R G B [alpha]"
669 "\t: Find label where indicated color is situated",
7fd59977 670 __FILE__, findColor, g);
671
9196ea9d 672 di.Add ("XUnsetColor","Doc {Label|Shape} {generic|surface|curve}"
673 "\t: Unset color",
7fd59977 674 __FILE__, unsetColor, g);
675
676 di.Add ("XSetObjVisibility","Doc {Label|Shape} (0\1) \t: Set the visibility of shape ",
677 __FILE__, setVisibility, g);
678
679 di.Add ("XGetObjVisibility","Doc {Label|Shape} \t: Return the visibility of shape ",
680 __FILE__, getVisibility, g);
681
682 di.Add ("XGetInstanceVisible","Doc Shape \t: Return the visibility of shape ",
683 __FILE__, getStyledVisibility, g);
684
9196ea9d 685 di.Add ("XGetInstanceColor","Doc Shape [{generic|surface|curve}=gen]"
686 "\t: Return the color of component shape",
7fd59977 687 __FILE__, getStyledcolor, g);
688
9196ea9d 689 di.Add ("XSetInstanceColor","Doc Shape R G B [alpha] [{generic|surface|curve}=gen]"
690 "\t: sets color for component of shape if SHUO structure exists already",
7fd59977 691 __FILE__, setStyledcolor, g);
7fd59977 692}