| http://www.sim.no/ http://www.coin3d.org/

SoVectorizeAction.h
1 #ifndef COIN_SOVECTORIZEACTION_H
2 #define COIN_SOVECTORIZEACTION_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/actions/SoCallbackAction.h>
28 #include <Inventor/actions/SoSubAction.h>
29 #include <Inventor/SbVec2f.h>
30 #include <Inventor/SbColor.h>
31
32 class SoVectorOutput;
33 class SbViewportRegion;
34 class SoVectorizeItem;
35 class SoVectorizeActionP;
36 class SbBSPTree;
37
38 // *************************************************************************
39
40 class COIN_DLL_API SoVectorizeAction : public SoCallbackAction {
41 typedef SoCallbackAction inherited;
42
43 SO_ACTION_HEADER(SoVectorizeAction);
44
45 public:
46 SoVectorizeAction(void);
47 virtual ~SoVectorizeAction();
48
49 SoVectorOutput * getOutput(void) const;
50
51 static void initClass(void);
52
53 enum DimensionUnit { INCH, MM, METER };
54 enum Orientation { PORTRAIT, LANDSCAPE };
55
56 enum PageSize {
57 A0 = 0,
58 A1,
59 A2,
60 A3,
61 A4,
62 A5,
63 A6,
64 A7,
65 A8,
66 A9,
67 A10
68 };
69
70 virtual void apply(SoNode * node);
71 virtual void apply(SoPath * path);
72 virtual void apply(const SoPathList & pathlist, SbBool obeysrules = FALSE);
73
74 void beginStandardPage(const PageSize & pagesize, const float border = 10.0f);
75
76 virtual void beginPage(const SbVec2f & startpagepos,
77 const SbVec2f & pagesize,
78 DimensionUnit u = MM);
79 virtual void endPage(void);
80
81 virtual void calibrate(const SbViewportRegion & vp);
82
83 virtual void beginViewport(const SbVec2f & startpos = SbVec2f(-1.0f, 1.0f),
84 const SbVec2f & size = SbVec2f(-1.0f, -1.0f),
85 DimensionUnit u = MM);
86 virtual void endViewport(void);
87
88 virtual void setOrientation(Orientation o);
89 virtual Orientation getOrientation(void) const;
90
91 virtual void setBackgroundColor(SbBool bg, const SbColor & col = SbColor(0.0f, 0.0f, 0.0f));
92 virtual SbBool getBackgroundColor(SbColor & col) const;
93
94 virtual void setNominalWidth(float w, DimensionUnit u = MM);
95 virtual float getNominalWidth(DimensionUnit u = MM) const;
96
97 virtual void setPixelImageSize(float w, DimensionUnit u = MM);
98 virtual float getPixelImageSize(DimensionUnit u = MM) const;
99
100 enum PointStyle {
101 CIRCLE,
102 SQUARE
103 };
104
105 virtual void setPointStyle(const PointStyle & style);
106 virtual PointStyle getPointStyle(void) const;
107
108 const SbVec2f & getPageStartpos(void) const;
109 const SbVec2f & getPageSize(void) const;
110
111 public:
112 // for TGS OIV compatibility. Might be implemented in the future
113 enum ColorTranslationMethod { REVERSE_ONLY_BLACK_AND_WHITE, AS_IS, REVERSE };
114
115 enum JoinLineStyle { NO_JOIN, MITERED_JOIN, MITERED_BEVELED_JOIN,
116 BEVELED_JOIN, TRIANGULAR_JOIN, ROUNDED_JOIN } ;
117 enum EndLineStyle { BUTT_END, SQUARE_END, TRIANGULAR_END, ROUND_END };
118 enum HLHSRMode { NO_HLHSR, HLHSR_SIMPLE_PAINTER, HLHSR_PAINTER,
119 HLHSR_PAINTER_SURFACE_REMOVAL, HIDDEN_LINES_REMOVAL };
120
121 virtual void setDrawingDimensions(const SbVec2f & d, DimensionUnit u = MM);
122 virtual void setDrawingDimensions(float w, float h, DimensionUnit u = MM) { this->setDrawingDimensions(SbVec2f(w, h), u); }
123 virtual SbVec2f getDrawingDimensions(DimensionUnit u = MM) const;
124
125 virtual void setStartPosition(const SbVec2f & p, DimensionUnit u = MM);
126 virtual void setStartPosition(float x, float y, DimensionUnit u = MM) { this->setStartPosition(SbVec2f(x, y), u); }
127 virtual SbVec2f getStartPosition(DimensionUnit u = MM) const;
128
129 virtual void setColorTranslationMethod(ColorTranslationMethod method);
130 virtual ColorTranslationMethod getColorTranslationMethod(void) const;
131
132 virtual void setLineEndStyle(EndLineStyle style);
133 virtual EndLineStyle getLineEndStyle(void) const;
134
135 virtual void setLineJoinsStyle(JoinLineStyle style);
136 virtual JoinLineStyle getLineJoinsStyle(void) const;
137
138 virtual void setHLHSRMode(HLHSRMode mode);
139 HLHSRMode getHLHSRMode(void) const;
140
141 virtual void setBorder(float width);
142 virtual void setBorder (float width, SbColor color);
143
144 virtual void setMiterLimit(float limit);
145 virtual float getMiterLimit(void) const;
146
147 virtual void setPenDescription(int num_pens,
148 const SbColor* colors = 0,
149 const float * widths = 0,
150 DimensionUnit u = MM);
151 virtual void getPenDescription(SbColor * colors,
152 float * widths,
153 DimensionUnit u = MM) const;
154 virtual int getPenNum(void) const;
155
156 virtual void setColorPriority(SbBool priority);
157 virtual SbBool getColorPriority(void) const;
158
159 virtual void enableLighting(SbBool flag);
160 SbBool isLightingEnabled(void) const;
161
162 protected:
163 void setOutput(SoVectorOutput * output);
164
165 virtual float pixelsToUnits(const int pixels);
166 virtual void printHeader(void) const = 0;
167 virtual void printFooter(void) const;
168 virtual void printBackground(void) const;
169 virtual void printItem(const SoVectorizeItem * item) const = 0;
170 virtual void printViewport(void) const;
171
172 SbVec2f getRotatedViewportStartpos(void) const;
173 SbVec2f getRotatedViewportSize(void) const;
174
175 const SbBSPTree & getBSPTree(void) const;
176
177 private:
178 SoVectorizeActionP * pimpl;
179 friend class SoVectorizeActionP;
180 };
181
182 // *************************************************************************
183
184 #ifndef COIN_INTERNAL
185 // For SGI / TGS Open Inventor compile-time compatibility.
186 #include <Inventor/nodes/SoImage.h>
187 #endif // COIN_INTERNAL
188
189 // *************************************************************************
190
191 #endif // !COIN_SOVECTORIZEACTION_H
SbVec2f
The SbVec2f class is a 2 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec2f.h:39
SbColor
The SbColor class contains the red, green and blue components which make up a color value...
Definition: SbColor.h:30
SoVectorizeAction::CIRCLE
Definition: SoVectorizeAction.h:101
SoVectorizeAction
The SoVectorizeAction class is the base class for vectorizing Coin scene graphs.SoVectorizeAction wil...
Definition: SoVectorizeAction.h:40
SoPathList
The SoPathList class is a container for pointers to SoPath objects.As this class inherits SoBaseList...
Definition: SoPathList.h:31
SoVectorizeAction::A1
Definition: SoVectorizeAction.h:58
SoNode
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
SoVectorizeAction::A9
Definition: SoVectorizeAction.h:66
SoVectorizeAction::DimensionUnit
DimensionUnit
Definition: SoVectorizeAction.h:53
SbBSPTree
The SbBSPTree class provides a binary space partitioning container.This class can be used to organize...
Definition: SbBSPTree.h:45
SoVectorOutput
The SoVectorOutput class is used for setting vector output file.SoVectorizeAction will create an SoVe...
Definition: SoVectorOutput.h:34
SoPath
The SoPath class is a container class for traversal path descriptions.SoPath objects contain a list o...
Definition: SoPath.h:43
SoVectorizeAction::A7
Definition: SoVectorizeAction.h:64
SoVectorizeAction::PointStyle
PointStyle
Definition: SoVectorizeAction.h:100
SoAction
The SoAction class is the base class for all traversal actions.Applying actions is the basic mechanis...
Definition: SoAction.h:68
SoVectorizeAction::Orientation
Orientation
Definition: SoVectorizeAction.h:54
SoVectorizeAction::A6
Definition: SoVectorizeAction.h:63
SoVectorizeAction::A2
Definition: SoVectorizeAction.h:59
SoVectorizeAction::A8
Definition: SoVectorizeAction.h:65
SoVectorizeAction::A5
Definition: SoVectorizeAction.h:62
SoCallbackAction
The SoCallbackAction class invokes callbacks at specific nodes.This action has mechanisms for trackin...
Definition: SoCallbackAction.h:71
SbViewportRegion
The SbViewportRegion class is a viewport within a full window.The SbViewportRegion class contains inf...
Definition: SbViewportRegion.h:31
SoVectorizeAction::PageSize
PageSize
Definition: SoVectorizeAction.h:56
SoAction::apply
virtual void apply(SoNode *root)
Definition: SoAction.cpp:459
SoVectorizeAction::A3
Definition: SoVectorizeAction.h:60
SoVectorizeAction::A4
Definition: SoVectorizeAction.h:61

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.