mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
904
src/Aspect/Aspect.cdl
Executable file
904
src/Aspect/Aspect.cdl
Executable file
@@ -0,0 +1,904 @@
|
||||
-- Package: Aspect
|
||||
-- Author: NW,JPB,CAL
|
||||
-- Created: Jeudi 22 Aout 1991
|
||||
-- Updated: Vendredi 2 Octobre 1992
|
||||
-- Mercredi 31 mars 1993
|
||||
-- Lundi 16 janvier 1995
|
||||
-- Reason : Traitement des Markers (G400)
|
||||
--
|
||||
-- Copyright: MatraDatavision 1991,1992,1993
|
||||
--
|
||||
-- Purpose: Specifications definitives
|
||||
--
|
||||
--
|
||||
-- File: Aspect.cdl
|
||||
-- Created: Jeudi 22 Aout 1991
|
||||
-- Author: NW,JPB,CAL
|
||||
-- Modified: 15/01/98 ; FMN : Ajout Hidden Line
|
||||
-- Modified: 07/07/98 ; DCB : Adding plotmode enum
|
||||
-- Modified: 07-07-98 by DCB (S3602 study)
|
||||
-- Adding plotmode enum
|
||||
-- Modified: 20-07-98 by DCB (S3602 study)
|
||||
-- Adding Plotter and PlotterConfigTool classes
|
||||
-- to plotters (PLO)
|
||||
-- Modified: 22-07-98 by DCB
|
||||
-- Adding DriverPtr, PlotterDriverPtr, WindowDriverPtr
|
||||
-- pointers.
|
||||
-- Modified: 24/08/98 ; CAL : S3892. Ajout grilles 3d.
|
||||
-- Modified: 16-09-98 by BGN (S3989)
|
||||
--- Adding TypeOfTriedronEcho, TypeOfTriedronPosition.
|
||||
-- Modified: 30-11-98 ; FMN : S4069. Textes always visible.
|
||||
-- Modified: 30/10/98 : DCB : S4046
|
||||
-- Adding class PlotterParameter and changing the Plotter's class
|
||||
-- implementation according to new PLO specifications (S3604 ???)
|
||||
-- Also new classes : (H)Array1OfPlotterParameter
|
||||
-- New enumeration : TypeOfPlotterParameter.
|
||||
-- New exception : PlotterParameterError.
|
||||
-- Modified: 25-NOV-98 : DCB
|
||||
-- Removing all plotters specific implementation from Aspect.
|
||||
-- These classes and enums will now be located in PlotMgt.
|
||||
-- Modified: 17-NOV-99 : GG GER61351
|
||||
-- Add TypeOfFacingModel enum
|
||||
-- Modified: 20-JAN-00 : GG
|
||||
-- Add GDM_None in enum GridDrawMode.
|
||||
-- Modified: 25-JAN-00 : VKH
|
||||
-- Add class PixMap
|
||||
-- Modified: 26-JAN-00 : EUG/GG G003
|
||||
-- Add enum TypeOfDegenerateModel
|
||||
-- Modified: 23-FEB-00 : GG
|
||||
-- Returns format name in ValuesOfFOSP() internal method.
|
||||
-- Modified: 27-03-02 RIC120302 GG Add imported class
|
||||
-- Display, Drawable, RenderingContext, GraphicCallbackProc
|
||||
-- Modified: 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
|
||||
-- Modified: 21-06-04 STV Added Aspect_ColorScale class
|
||||
|
||||
---Copyright: MatraDatavision 1991,1992,1993
|
||||
------------------------------------------------------------------------
|
||||
|
||||
package Aspect
|
||||
|
||||
---Version:
|
||||
|
||||
---Purpose: This package contains the group of graphic elements common
|
||||
-- to different types of visualisers. It allows the description
|
||||
-- of a screen background, a window, an edge, and groups of
|
||||
-- graphic attributes that can be used in describing 2D
|
||||
-- and 3D objects.
|
||||
|
||||
---Keywords: Window, Aspect, FillArea, Line, Marker, Edge
|
||||
-- Highlight, Hatch, Background, GradientBackground, Color map,
|
||||
-- Type map, Width map, Font map
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
TCollection,
|
||||
TColStd,
|
||||
TShort,
|
||||
Quantity,
|
||||
TColQuantity,
|
||||
Resource,
|
||||
Viewer,
|
||||
MMgt
|
||||
|
||||
is
|
||||
---------------------------
|
||||
-- Category: Imported types
|
||||
---------------------------
|
||||
imported FStream;
|
||||
-- waiting for RBA creating this class in Standard ...
|
||||
|
||||
imported IFStream;
|
||||
-- G002A study
|
||||
|
||||
imported CLayer2d;
|
||||
---Purpose: Defines the C structure <alayer>
|
||||
---Category: Imported types
|
||||
|
||||
imported RGBPixel;
|
||||
---Purpose:
|
||||
|
||||
primitive Handle;
|
||||
primitive Drawable;
|
||||
---Purpose:
|
||||
-- To manage Drawable
|
||||
|
||||
primitive Display;
|
||||
---Purpose:
|
||||
-- To manage Display
|
||||
|
||||
primitive RenderingContext;
|
||||
---Purpose:
|
||||
-- To manage 2D or 3D graphic context
|
||||
|
||||
imported GraphicCallbackProc;
|
||||
---Purpose:
|
||||
-- To manage client post display
|
||||
|
||||
-- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
|
||||
imported PolygonOffsetMode;
|
||||
---Purpose:
|
||||
-- Enumeration for polygon offset modes
|
||||
|
||||
---------------------
|
||||
-- Category: Pointers
|
||||
---------------------
|
||||
|
||||
pointer DriverPtr to Driver from Aspect;
|
||||
pointer WindowDriverPtr to WindowDriver from Aspect;
|
||||
|
||||
---Category: Pointers
|
||||
|
||||
-----------------------
|
||||
-- Category: Exceptions
|
||||
-----------------------
|
||||
|
||||
exception AspectLineDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception AspectFillAreaDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception AspectMarkerDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception BadAccess inherits DomainError;
|
||||
---Category: Exceptions
|
||||
|
||||
exception ColorMapDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception EdgeDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception IdentDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception TypeMapDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception WidthMapDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception FontMapDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception MarkMapDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception WindowDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception WindowError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception PixmapDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception PixmapError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception DriverDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception DriverError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception GraphicDeviceDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
exception LineStyleDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception LineWidthDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception PolyStyleDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception FontStyleDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception MarkerStyleDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception UndefinedMap inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
------------------------------
|
||||
-- Category: Classes Color map
|
||||
------------------------------
|
||||
|
||||
deferred class ColorMap;
|
||||
---Purpose: Defines a color map.
|
||||
---Category: Classes Color map
|
||||
|
||||
class ColorCubeColorMap;
|
||||
---Purpose: Associates a index and a color in the "ColorCube" space.
|
||||
---Category: Classes Color map
|
||||
|
||||
class ColorRampColorMap;
|
||||
---Purpose: Associates a index and a color in the linear "ColorRamp"
|
||||
-- space.
|
||||
---Category: Classes Color map
|
||||
|
||||
class GenericColorMap;
|
||||
---Purpose: Associates an index and a color.
|
||||
---Category: Classes Color map
|
||||
|
||||
class ColorMapEntry;
|
||||
---Purpose: Defines an entry in the color map :
|
||||
-- an index and a color.
|
||||
---Category: Classes Color map
|
||||
|
||||
------------------------------
|
||||
-- Category: Classes Pixel
|
||||
------------------------------
|
||||
|
||||
deferred class Pixel;
|
||||
---Purpose: Defines a picture element.
|
||||
---Category: Classes Pixel
|
||||
|
||||
class IndexPixel;
|
||||
---Purpose:
|
||||
---Category: Classes Pixel
|
||||
|
||||
class ColorPixel;
|
||||
---Purpose:
|
||||
---Category: Classes Pixel
|
||||
|
||||
---------------------------
|
||||
-- Category: Classes Aspect
|
||||
---------------------------
|
||||
|
||||
deferred class AspectLine;
|
||||
---Purpose: Creates and updates a group of graphic attributes
|
||||
-- for primitives 'Line'
|
||||
---Category: Classes Aspect
|
||||
|
||||
deferred class AspectMarker;
|
||||
---Purpose: Creates and updates a group of graphic attributes
|
||||
-- for primitives 'Marker'.
|
||||
---Category: Classes Aspect
|
||||
|
||||
deferred class AspectFillArea;
|
||||
---Purpose: Creates and updates a group of graphic attributes
|
||||
-- for primitives 'Face'.
|
||||
---Category: Classes Aspect
|
||||
|
||||
--------------------
|
||||
-- Category: Classes
|
||||
--------------------
|
||||
|
||||
class Background;
|
||||
---Purpose: Defines a window background
|
||||
---Category: Classes
|
||||
|
||||
class GradientBackground;
|
||||
---Purpose: Defines a window gradient background
|
||||
---Category: Classes
|
||||
|
||||
class Edge;
|
||||
---Purpose: Defines an edge.
|
||||
---Category: Classes
|
||||
|
||||
class GenId;
|
||||
---Purpose: Creates and controles all identifiers.
|
||||
---Category: Classes
|
||||
|
||||
deferred class GraphicDriver;
|
||||
---Purpose: Defines a graphic driver (3d library)
|
||||
|
||||
class FontStyle;
|
||||
---Purpose: Defines a Font Style
|
||||
---Category: The classes
|
||||
|
||||
class FontMapEntry;
|
||||
---Purpose: Defines an entry in the Font map :
|
||||
-- an index and a text Font.
|
||||
---Category: Classes Font map
|
||||
|
||||
class FontMap;
|
||||
---Purpose: Associates an index and a text Font entry.
|
||||
---Category: The classes
|
||||
|
||||
class WidthMapEntry;
|
||||
---Purpose: Defines an entry in the Width map :
|
||||
-- an index and a line Width.
|
||||
---Category: Classes Width map
|
||||
|
||||
class WidthMap;
|
||||
---Purpose: Associates an index and a line width entry.
|
||||
---Category: The classes
|
||||
|
||||
class LineStyle;
|
||||
---Purpose: Defines a Line Style
|
||||
---Category: The classes
|
||||
|
||||
class TypeMap;
|
||||
---Purpose: Associates an index and a line type entry.
|
||||
---Category: The classes
|
||||
|
||||
class TypeMapEntry;
|
||||
---Purpose: Defines an entry in the Type map :
|
||||
-- an index and a line style.
|
||||
---Category: Classes Type map
|
||||
|
||||
class MarkerStyle;
|
||||
---Purpose: Defines a Marker Style
|
||||
---Category: The classes
|
||||
|
||||
class MarkMap;
|
||||
---Purpose: Associates an index and a Marker entry.
|
||||
---Category: The classes
|
||||
|
||||
class MarkMapEntry;
|
||||
---Purpose: Defines an entry in the Marker map :
|
||||
-- an index and a marker style.
|
||||
---Category: Classes Mark map
|
||||
|
||||
deferred class Window;
|
||||
---Purpose: Defines a window.
|
||||
---Category: Classes
|
||||
|
||||
deferred class PixMap;
|
||||
---Purpose: Defines a pixmap(bitmap)
|
||||
---Category: Classes
|
||||
|
||||
deferred class GraphicDevice;
|
||||
---Purpose: Defines a physical graphic device allowing to
|
||||
-- shares graphical ressources.
|
||||
---Category: Classes
|
||||
|
||||
deferred class Driver;
|
||||
---Purpose: Defines a virtual driver.
|
||||
---Category: Classes
|
||||
|
||||
deferred class WindowDriver;
|
||||
---Purpose: Defines a virtual driver associated to a window.
|
||||
---Category: Classes
|
||||
|
||||
deferred class Grid;
|
||||
class RectangularGrid;
|
||||
class CircularGrid;
|
||||
|
||||
deferred class ColorScale;
|
||||
---Purpose: Defines a color scale for viewer.
|
||||
|
||||
-------------------------
|
||||
-- Category: Enumerations
|
||||
-------------------------
|
||||
|
||||
enumeration HatchStyle is HS_HORIZONTAL,
|
||||
HS_HORIZONTAL_WIDE,
|
||||
HS_VERTICAL,
|
||||
HS_VERTICAL_WIDE,
|
||||
HS_DIAGONAL_45,
|
||||
HS_DIAGONAL_45_WIDE,
|
||||
HS_DIAGONAL_135,
|
||||
HS_DIAGONAL_135_WIDE,
|
||||
HS_GRID,
|
||||
HS_GRID_WIDE,
|
||||
HS_GRID_DIAGONAL,
|
||||
HS_GRID_DIAGONAL_WIDE
|
||||
end HatchStyle;
|
||||
---Purpose: Definition of all available hatch styles.
|
||||
--
|
||||
-- HS_HORIZONTAL
|
||||
-- HS_HORIZONTAL_WIDE
|
||||
-- HS_VERTICAL
|
||||
-- HS_VERTICAL_WIDE
|
||||
-- HS_DIAGONAL_45
|
||||
-- HS_DIAGONAL_45_WIDE
|
||||
-- HS_DIAGONAL_135
|
||||
-- HS_DIAGONAL_135_WIDE
|
||||
-- HS_GRID
|
||||
-- HS_GRID_WIDE
|
||||
-- HS_GRID_DIAGONAL
|
||||
-- HS_GRID_DIAGONAL_WIDE
|
||||
--
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration InteriorStyle is IS_EMPTY,
|
||||
IS_HOLLOW,
|
||||
IS_HATCH,
|
||||
IS_SOLID,
|
||||
IS_HIDDENLINE
|
||||
end InteriorStyle;
|
||||
---Purpose: Definition of interior types for primitive
|
||||
-- faces.
|
||||
--
|
||||
-- IS_EMPTY no interior.
|
||||
-- IS_HOLLOW display the boundaries of the surface.
|
||||
-- IS_HATCH display hatched with a hatch style.
|
||||
-- IS_SOLID display the interior entirely filled.
|
||||
-- IS_HIDDENLINE display in hidden lines removed.
|
||||
--
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfColorMap is TOC_Generic,
|
||||
TOC_ColorCube,
|
||||
TOC_ColorRamp
|
||||
end TypeOfColorMap;
|
||||
---Purpose: Definition of the color map types
|
||||
--
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfConstraint is TOC_BOTTOM_LEFT,
|
||||
TOC_BOTTOM_RIGHT,
|
||||
TOC_TOP_LEFT,
|
||||
TOC_TOP_RIGHT
|
||||
end TypeOfConstraint;
|
||||
---Purpose: Definition of the attachment for the layers
|
||||
--
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfDrawMode is TODM_REPLACE,
|
||||
TODM_ERASE,
|
||||
TODM_XOR,
|
||||
TODM_XORLIGHT
|
||||
end TypeOfDrawMode;
|
||||
---Purpose: Definition of the draw modes
|
||||
--
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfEdge is TOE_VISIBLE,
|
||||
TOE_INVISIBLE
|
||||
end TypeOfEdge;
|
||||
---Purpose: Definition of edge visibility
|
||||
--
|
||||
-- TOE_VISIBLE Edge is displayed
|
||||
-- TOE_INVISIBLE Edge is not displayed
|
||||
--
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfHighlightMethod is TOHM_COLOR,
|
||||
TOHM_BLINK,
|
||||
TOHM_BOUNDBOX
|
||||
end TypeOfHighlightMethod;
|
||||
---Purpose: Definition of a highlight method
|
||||
--
|
||||
-- TOHM_COLOR drawn in the highlight color
|
||||
-- (default white)
|
||||
-- TOHM_BLINK blinking
|
||||
-- TOHM_BOUNDBOX enclosed by the boundary box
|
||||
-- (default white)
|
||||
--
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfLine is TOL_SOLID,
|
||||
TOL_DASH,
|
||||
TOL_DOT,
|
||||
TOL_DOTDASH,
|
||||
TOL_USERDEFINED
|
||||
end TypeOfLine;
|
||||
---Purpose: Definition of line types
|
||||
--
|
||||
-- TOL_SOLID continuous
|
||||
-- TOL_DASH dashed 2.0,1.0 (MM)
|
||||
-- TOL_DOT dotted 0.2,0.5 (MM)
|
||||
-- TOL_DOTDASH mixed 10.0,1.0,2.0,1.0 (MM)
|
||||
-- TOL_USERDEFINED defined by Users
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration WidthOfLine is WOL_THIN,
|
||||
WOL_MEDIUM,
|
||||
WOL_THICK,
|
||||
WOL_VERYTHICK,
|
||||
WOL_USERDEFINED
|
||||
end WidthOfLine;
|
||||
---Purpose: Definition of line types
|
||||
--
|
||||
-- WOL_THIN thin line (1 pixel width)
|
||||
-- WOL_MEDIUM medium width of 0.5 MM
|
||||
-- WOL_THICK thick width of 0.7 MM
|
||||
-- WOL_VERYTHICK very thick width of 1.5 MM
|
||||
-- WOL_USERDEFINED defined by Users
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfFont is TOF_DEFAULT,
|
||||
TOF_COURIER,
|
||||
TOF_HELVETICA,
|
||||
TOF_TIMES,
|
||||
TOF_USERDEFINED
|
||||
end TypeOfFont;
|
||||
---Purpose: Definition of line types
|
||||
--
|
||||
-- TOF_DEFAULT Default system font
|
||||
-- TOF_COURIER
|
||||
-- TOF_HELVETICA
|
||||
-- TOF_USERDEFINED defined by Users
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfText is TOT_SOLID,
|
||||
TOT_OUTLINE
|
||||
end TypeOfText;
|
||||
---Purpose: Definition of Text types
|
||||
--
|
||||
-- TOF_SOLID Default text
|
||||
-- TOF_OUTLINE
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfStyleText is TOST_NORMAL,
|
||||
TOST_ANNOTATION
|
||||
end TypeOfStyleText;
|
||||
---Purpose: Define the style of the text.
|
||||
--
|
||||
-- TOST_NORMAL Default text. The text is displayed like any other graphic object.
|
||||
-- This text can be hidden by another object that is nearest from the
|
||||
-- point of view.
|
||||
-- TOST_ANNOTATION The text is always visible. The texte is displayed
|
||||
-- over the other object according to the priority.
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfDisplayText is TODT_NORMAL,
|
||||
TODT_SUBTITLE,
|
||||
TODT_DEKALE,
|
||||
TODT_BLEND
|
||||
end TypeOfDisplayText;
|
||||
---Purpose: Define the display type of the text.
|
||||
--
|
||||
-- TODT_NORMAL Default display. Text only.
|
||||
-- TODT_SUBTITLE There is a subtitle under the text.
|
||||
-- TODT_DEKALE The text is displayed with a 3D style.
|
||||
-- TODT_BLEND The text is displayed in XOR.
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfMarker is TOM_POINT,
|
||||
TOM_PLUS,
|
||||
TOM_STAR,
|
||||
TOM_O,
|
||||
TOM_X,
|
||||
TOM_O_POINT,
|
||||
TOM_O_PLUS,
|
||||
TOM_O_STAR,
|
||||
TOM_O_X,
|
||||
TOM_BALL,
|
||||
TOM_RING1,
|
||||
TOM_RING2,
|
||||
TOM_RING3,
|
||||
TOM_USERDEFINED
|
||||
end TypeOfMarker;
|
||||
---Purpose: Definition of types of markers
|
||||
--
|
||||
-- TOM_POINT point .
|
||||
-- TOM_PLUS plus +
|
||||
-- TOM_STAR star *
|
||||
-- TOM_O circle O
|
||||
-- TOM_X cross x
|
||||
-- TOM_O_POINT a point in a circle
|
||||
-- TOM_O_PLUS a plus in a circle
|
||||
-- TOM_O_STAR a star in a circle
|
||||
-- TOM_O_X a cross in a circle
|
||||
-- TOM_BALL a ball with 1 color and different saturations
|
||||
-- TOM_RING1 a large ring
|
||||
-- TOM_RING2 a medium ring
|
||||
-- TOM_RING3 a small ring
|
||||
-- TOM_USERDEFINED defined by Users
|
||||
--
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfUpdate is TOU_ASAP,
|
||||
TOU_WAIT
|
||||
end TypeOfUpdate;
|
||||
---Purpose: Definition of screen refresh mode
|
||||
--
|
||||
-- TOU_ASAP as soon as possible
|
||||
-- TOU_WAIT on demand (Update)
|
||||
--
|
||||
---Category: Enumerations
|
||||
|
||||
enumeration TypeOfDeflection is TOD_RELATIVE,
|
||||
TOD_ABSOLUTE
|
||||
end TypeOfDeflection;
|
||||
---Purpose: Defines if the maximal chordial deflection used when
|
||||
-- drawing an object is absolute or relative to the size
|
||||
-- of the object.
|
||||
|
||||
enumeration TypeOfResize is TOR_UNKNOWN,
|
||||
TOR_NO_BORDER,
|
||||
TOR_TOP_BORDER,
|
||||
TOR_RIGHT_BORDER,
|
||||
TOR_BOTTOM_BORDER,
|
||||
TOR_LEFT_BORDER,
|
||||
TOR_TOP_AND_RIGHT_BORDER,
|
||||
TOR_RIGHT_AND_BOTTOM_BORDER,
|
||||
TOR_BOTTOM_AND_LEFT_BORDER,
|
||||
TOR_LEFT_AND_TOP_BORDER
|
||||
end TypeOfResize;
|
||||
---Purpose: Defines the type of Resize Window method applied
|
||||
-- by the user.
|
||||
|
||||
enumeration CardinalPoints is CP_North,
|
||||
CP_NorthEast,
|
||||
CP_East,
|
||||
CP_SouthEast,
|
||||
CP_South,
|
||||
CP_SouthWest,
|
||||
CP_West,
|
||||
CP_NorthWest,
|
||||
CP_Center
|
||||
end CardinalPoints;
|
||||
|
||||
enumeration TypeOfRenderingMode is TORM_IMMEDIAT,
|
||||
TORM_RETAIN,
|
||||
TORM_CLEAR_AND_RETAIN
|
||||
end TypeOfRenderingMode;
|
||||
---Purpose: Definition of the rendering modes
|
||||
|
||||
enumeration TypeOfColorSpace is TOCS_BlackAndWhite,
|
||||
TOCS_GreyScale,
|
||||
TOCS_RGB
|
||||
end TypeOfColorSpace;
|
||||
---Purpose:
|
||||
|
||||
enumeration FormatOfSheetPaper is
|
||||
FOSP_A0, -- 0.841 x 1.189 (M)
|
||||
FOSP_A1, -- 0.594 x 0.841 (M)
|
||||
FOSP_A2, -- 0.420 x 0.594 (M)
|
||||
FOSP_A3, -- 0.297 x 0.420 (M)
|
||||
FOSP_A4, -- 0.210 x 0.297 (M)
|
||||
FOSP_A5, -- 0.1485 x 0.210 (M)
|
||||
FOSP_K_LONG, -- 1.016 x 3.6322 (M)
|
||||
FOSP_K_SHORT, -- 1.016 x 1.397 (M)
|
||||
FOSP_J_LONG, -- 0.8636 x 4.4704 (M)
|
||||
FOSP_J_SHORT, -- 0.8636 x 1.397 (M)
|
||||
FOSP_H_LONG, -- 0.7112 x 3.6322 (M)
|
||||
FOSP_H_SHORT, -- 0.7112 x 1.1176 (M)
|
||||
FOSP_G_LONG, -- 0.2794 x 2.286 (M)
|
||||
FOSP_G_SHORT, -- 0.2794 x 0.5715 (M)
|
||||
FOSP_F, -- 0.7112 x 1.016 (M)
|
||||
FOSP_E, -- 0.8636 x 1.1176 (M)
|
||||
FOSP_D, -- 0.5588 x 0.8636 (M)
|
||||
FOSP_C, -- 0.4318 x 0.5588 (M)
|
||||
FOSP_B, -- 0.2794 x 0.4318 (M)
|
||||
FOSP_A, -- 0.2159 x 0.2794 (M)
|
||||
FOSP_UNKNOWN -- User defined
|
||||
end FormatOfSheetPaper;
|
||||
---Purpose:
|
||||
|
||||
enumeration TypeOfPrimitive is
|
||||
TOP_UNKNOWN,
|
||||
TOP_POLYLINE,
|
||||
TOP_POLYGON,
|
||||
TOP_SEGMENTS,
|
||||
TOP_ARCS,
|
||||
TOP_POLYARCS,
|
||||
TOP_POINTS,
|
||||
TOP_MARKERS
|
||||
end TypeOfPrimitive;
|
||||
---Purpose:
|
||||
|
||||
enumeration GridDrawMode is GDM_Lines,
|
||||
GDM_Points,
|
||||
GDM_None
|
||||
end GridDrawMode;
|
||||
---Purpose: Defines the grid draw mode. The grid may be drawn
|
||||
-- by using lines or points.
|
||||
|
||||
enumeration GridType is GT_Rectangular,
|
||||
GT_Circular
|
||||
end GridType;
|
||||
---Purpose: Defines the grid type : Rectangular or Circular.
|
||||
|
||||
--------- Start DCB modification ----------------------------------------
|
||||
enumeration PlotMode is
|
||||
PM_DPLOTTER,
|
||||
PM_FILEONLY,
|
||||
PM_NPLOTTER
|
||||
end PlotMode;
|
||||
---Purpose: Defines plot mode for plotter drivers derived from
|
||||
-- Aspect_PlotterDriver:
|
||||
-- 1) PM_DPLOTTER - send file to plotter and delete file
|
||||
-- 2) PM_FILEONLY - do not send file to the plotter
|
||||
-- 3) PM_NPLOTTER - send file to the plotter but not delete a file
|
||||
|
||||
|
||||
enumeration ListingType is
|
||||
LPID_DIRPLOT,
|
||||
LPID_DIRPARPLO,
|
||||
LPID_ALLDIRS
|
||||
end ListingType;
|
||||
---Purpose: Defines where to search plotter files (PLO)
|
||||
|
||||
enumeration PlotterOrigin is
|
||||
PO_CENTER,
|
||||
PO_BOTTOMLEFT,
|
||||
PO_TOPLEFT,
|
||||
PO_TOPRIGHT,
|
||||
PO_BOTTOMRIGHT,
|
||||
PO_UNKNOWN
|
||||
end PlotterOrigin;
|
||||
--------- Stop DCB modification ----------------------------------------
|
||||
|
||||
|
||||
enumeration TypeOfTriedronEcho is TOTE_NONE,
|
||||
TOTE_ORIGIN,
|
||||
TOTE_AXIS_X,
|
||||
TOTE_AXIS_Y,
|
||||
TOTE_AXIS_Z,
|
||||
TOTE_TEXT_X,
|
||||
TOTE_TEXT_Y,
|
||||
TOTE_TEXT_Z,
|
||||
TOTE_01,
|
||||
TOTE_02,
|
||||
TOTE_03,
|
||||
TOTE_04,
|
||||
TOTE_05,
|
||||
TOTE_06,
|
||||
TOTE_07,
|
||||
TOTE_08,
|
||||
TOTE_09,
|
||||
TOTE_10
|
||||
end TypeOfTriedronEcho;
|
||||
---Purpose: Definition of the Triedron echo zone to highlight
|
||||
--
|
||||
-- TOTE_NONE no echo zone
|
||||
-- TOTE_ORIGIN a box on origin of the Triedron
|
||||
-- TOTE_AXIS_X highlights the X axis
|
||||
-- TOTE_AXIS_Y highlights the Y axis
|
||||
-- TOTE_AXIS_Z highlights the Z axis
|
||||
-- TOTE_TEXT_X highlights the X character
|
||||
-- TOTE_TEXT_Y highlights the Y character
|
||||
-- TOTE_TEXT_Z highlights the Z character
|
||||
-- TOTE_01 to TOTE_10 not yet implemented.
|
||||
---Category: The enumerations
|
||||
|
||||
|
||||
enumeration TypeOfTriedronPosition is TOTP_CENTER,
|
||||
TOTP_LEFT_LOWER,
|
||||
TOTP_LEFT_UPPER,
|
||||
TOTP_RIGHT_LOWER,
|
||||
TOTP_RIGHT_UPPER,
|
||||
TOTP_01,
|
||||
TOTP_02,
|
||||
TOTP_03,
|
||||
TOTP_04,
|
||||
TOTP_05,
|
||||
TOTP_06,
|
||||
TOTP_07,
|
||||
TOTP_08,
|
||||
TOTP_09,
|
||||
TOTP_10
|
||||
end TypeOfTriedronPosition;
|
||||
---Purpose: Definition of the Triedron position in the views
|
||||
--
|
||||
-- TOTP_CENTER at the center of the view
|
||||
-- TOTP_LEFT_LOWER at the left lower corner
|
||||
-- TOTP_LEFT_UPPER at the left upper corner
|
||||
-- TOTP_RIGHT_LOWER at the right lower corner
|
||||
-- TOTP_RIGHT_UPPER at the right upper corner
|
||||
-- TOTP_01 to TOTP_10 not yet implemented.
|
||||
---Category: The enumerations
|
||||
|
||||
enumeration TypeOfLayer is TOL_OVERLAY,
|
||||
TOL_UNDERLAY
|
||||
end TypeOfLayer;
|
||||
---Purpose: Modes of drawing for the objects in a layer
|
||||
--
|
||||
-- TOL_OVERLAY, the graphic of the layer is draw
|
||||
-- after the 3d graphic.
|
||||
-- TOL_UNDERLAY, the graphic of the layer is draw
|
||||
-- before the 3d graphic.
|
||||
---Category: The enumerations
|
||||
|
||||
enumeration TypeOfFacingModel is TOFM_BOTH_SIDE,
|
||||
TOFM_BACK_SIDE,
|
||||
TOFM_FRONT_SIDE
|
||||
end TypeOfFacingModel;
|
||||
|
||||
enumeration TypeOfDegenerateModel is
|
||||
TDM_NONE,
|
||||
TDM_TINY,
|
||||
TDM_WIREFRAME,
|
||||
TDM_MARKER,
|
||||
TDM_BBOX,
|
||||
TDM_AUTO
|
||||
end TypeOfDegenerateModel;
|
||||
---Purpose: Defines type of degeneration model of the
|
||||
-- graphic structure.
|
||||
---Category: The enumerations
|
||||
|
||||
enumeration FillMethod is
|
||||
FM_NONE,
|
||||
FM_CENTERED,
|
||||
FM_TILED,
|
||||
FM_STRETCH
|
||||
end FillMethod;
|
||||
---Purpose: Defines the fill methods to
|
||||
-- write bitmaps in a window.
|
||||
|
||||
enumeration GradientFillMethod is
|
||||
GFM_NONE,
|
||||
GFM_HOR,
|
||||
GFM_VER,
|
||||
GFM_DIAG1,
|
||||
GFM_DIAG2,
|
||||
GFM_CORNER1,
|
||||
GFM_CORNER2,
|
||||
GFM_CORNER3,
|
||||
GFM_CORNER4
|
||||
end GradientFillMethod;
|
||||
---Purpose: Defines the fill methods to
|
||||
-- write gradient background in a window.
|
||||
|
||||
enumeration TypeOfColorScaleData is
|
||||
TOCSD_AUTO,
|
||||
TOCSD_USER
|
||||
end TypeOfColorScaleData;
|
||||
---Purpose: Defines the using type of colors and labels
|
||||
|
||||
enumeration TypeOfColorScalePosition is
|
||||
TOCSP_NONE,
|
||||
TOCSP_LEFT,
|
||||
TOCSP_RIGHT,
|
||||
TOCSP_CENTER
|
||||
end TypeOfColorScalePosition;
|
||||
---Purpose: Defines the type of position for color scale labels
|
||||
|
||||
enumeration TypeOfColorScaleOrientation is
|
||||
TOCSO_NONE,
|
||||
TOCSO_LEFT,
|
||||
TOCSO_RIGHT,
|
||||
TOCSO_CENTER
|
||||
end TypeOfColorScaleOrientation;
|
||||
---Purpose: Defines the type of color scale orientation
|
||||
|
||||
---------------------------------
|
||||
-- Category: Instantiated classes
|
||||
---------------------------------
|
||||
|
||||
class Array1OfEdge instantiates
|
||||
Array1 from TCollection (Edge from Aspect);
|
||||
---Category: Instantiated classes
|
||||
|
||||
class SequenceOfColorMapEntry instantiates
|
||||
Sequence from TCollection (ColorMapEntry from Aspect);
|
||||
---Category: Instantiated classes
|
||||
|
||||
class SequenceOfTypeMapEntry instantiates
|
||||
Sequence from TCollection (TypeMapEntry from Aspect);
|
||||
---Category: Instantiated classes
|
||||
|
||||
class SequenceOfWidthMapEntry instantiates
|
||||
Sequence from TCollection (WidthMapEntry from Aspect);
|
||||
---Category: Instantiated classes
|
||||
|
||||
class SequenceOfFontMapEntry instantiates
|
||||
Sequence from TCollection (FontMapEntry from Aspect);
|
||||
---Category: Instantiated classes
|
||||
|
||||
class SequenceOfMarkMapEntry instantiates
|
||||
Sequence from TCollection (MarkMapEntry from Aspect);
|
||||
---Category: Instantiated classes
|
||||
|
||||
class SequenceOfColor instantiates
|
||||
Sequence from TCollection(Color from Quantity);
|
||||
|
||||
----------------------------
|
||||
-- Category: Package methods
|
||||
----------------------------
|
||||
|
||||
ValuesOfFOSP (aFOSP : FormatOfSheetPaper from Aspect;
|
||||
aWidth, aHeight : out Length from Quantity)
|
||||
returns CString from Standard;
|
||||
---Level: Internal
|
||||
---Purpose: Returns the format size according to the default
|
||||
-- LENGTH unit of the required format <aFOSP>.
|
||||
-- Returns more the normalized format name.
|
||||
---Category: Package methods
|
||||
|
||||
ToCString (aString: ExtendedString from TCollection)
|
||||
returns CString from Standard;
|
||||
---Level: Internal
|
||||
---Purpose: Translates an ExtendedString to a CString
|
||||
-- depending of the local format.
|
||||
---Category: Package methods
|
||||
|
||||
Inverse ( aMat : Array2OfReal from TColStd;
|
||||
Inv : out Array2OfReal from TColStd )
|
||||
returns Boolean from Standard;
|
||||
---Level: Internal
|
||||
---Purpose: Inverses <aMat> a 4x4 matrix.
|
||||
|
||||
end Aspect;
|
280
src/Aspect/Aspect.cxx
Executable file
280
src/Aspect/Aspect.cxx
Executable file
@@ -0,0 +1,280 @@
|
||||
|
||||
#define XTRACE
|
||||
|
||||
#define UNICOD //GG_041196
|
||||
// Conformite UNICODE
|
||||
|
||||
// File Aspect.cxx
|
||||
// Created Mars 1996
|
||||
// Author CAL
|
||||
// Modified 22/12/97 : FMN ; Remplacement getenv par OSD_Environment
|
||||
// 27/12/98 : FMN ; PERF: OPTIMISATION LOADER (LOPTIM)
|
||||
// JR 02.01.100 : Implicit conversions
|
||||
//
|
||||
//-Copyright MatraDatavision 1996
|
||||
//
|
||||
//-Design Implementation des methodes de package
|
||||
|
||||
#include <Aspect.hxx>
|
||||
#include <Aspect_Units.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#ifdef UNICOD
|
||||
#include <Resource_Unicode.hxx>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
|
||||
# include <stdio.h>
|
||||
|
||||
// Valeurs en cms !
|
||||
static Quantity_Length Widths[20] = {
|
||||
84.1, 59.4, 42.0, 29.7, 21.0,
|
||||
14.85, 101.6, 101.6, 86.36, 86.36,
|
||||
71.12, 71.12, 27.94, 27.94, 71.12,
|
||||
86.36, 55.88, 43.18, 27.94, 21.59
|
||||
};
|
||||
|
||||
static Quantity_Length Heights[20] = {
|
||||
118.9, 84.1, 59.4, 42.0, 29.7,
|
||||
21.0, 363.22, 139.7, 447.04, 139.7,
|
||||
363.22, 111.76, 228.6, 57.15, 101.6,
|
||||
111.76, 86.36, 55.88, 43.18, 27.94
|
||||
};
|
||||
|
||||
static Standard_CString Fnames[] = {
|
||||
"A0","A1","A2","A3","A4","A5","KL","KS","JL","JS","HL","HS","GL","GS","F","E","D","C","B","A"
|
||||
};
|
||||
|
||||
#define LOPTIM
|
||||
#ifndef LOPTIM
|
||||
static TCollection_AsciiString astring;
|
||||
static TCollection_ExtendedString estring;
|
||||
#else
|
||||
static TCollection_AsciiString& _astring() {
|
||||
static TCollection_AsciiString astring;
|
||||
return astring;
|
||||
}
|
||||
#define astring _astring()
|
||||
|
||||
static TCollection_ExtendedString& _estring() {
|
||||
static TCollection_ExtendedString estring;
|
||||
return estring;
|
||||
}
|
||||
#define estring _estring()
|
||||
#endif // LOPTIM
|
||||
|
||||
// Returns size in meters
|
||||
Standard_CString Aspect::ValuesOfFOSP (
|
||||
const Aspect_FormatOfSheetPaper aFOSP,
|
||||
Quantity_Length& Width,
|
||||
Quantity_Length& Height) {
|
||||
|
||||
Standard_Integer Index = Standard_Integer (aFOSP);
|
||||
|
||||
Width = Quantity_Length (Widths[Index]) CENTIMETER;
|
||||
Height = Quantity_Length (Heights[Index]) CENTIMETER;
|
||||
|
||||
return Fnames[Index];
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
Standard_CString Aspect::ToCString(const TCollection_ExtendedString &aString) {
|
||||
Standard_PCharacter pstring;
|
||||
|
||||
#ifdef UNICOD
|
||||
Standard_Integer max_string = 2*aString.Length() + 2;
|
||||
astring = TCollection_AsciiString(max_string,' ');
|
||||
pstring = (Standard_PCharacter)astring.ToCString();
|
||||
estring = aString;
|
||||
Resource_FormatType aType = Resource_Unicode::GetFormat();
|
||||
if( (aType == Resource_EUC) || (aType == Resource_SJIS) ) {
|
||||
Standard_Integer i;
|
||||
Standard_ExtCharacter c;
|
||||
for( i=1 ; i<=aString.Length() ; i++ ) {
|
||||
c = estring.Value(i);
|
||||
if( (c >= 0) && (c <= Standard_ExtCharacter(0x0020)) ) {
|
||||
c = Standard_ExtCharacter(0x3000);
|
||||
estring.SetValue(i,c);
|
||||
} else if( (c > Standard_ExtCharacter(0x0020)) &&
|
||||
(c <= Standard_ExtCharacter(0x007F)) ) {
|
||||
c += Standard_ExtCharacter(0xFEE0);
|
||||
estring.SetValue(i,c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// char *jf = getenv("CSF_JIS_Font");
|
||||
// if (((aType == Resource_EUC) || (aType == Resource_SJIS)) && (jf!=((char *)0))) {
|
||||
OSD_Environment aVariable("CSF_JIS_Font");
|
||||
TCollection_AsciiString jf(aVariable.Value());
|
||||
if (((aType == Resource_EUC) || (aType == Resource_SJIS)) && (jf.Length() != 0)) {
|
||||
Standard_PCharacter p;
|
||||
|
||||
Resource_Unicode::ConvertUnicodeToEUC(estring,
|
||||
pstring,
|
||||
max_string);
|
||||
p=(Standard_PCharacter)pstring;
|
||||
while ((*p)!='\0') {
|
||||
*p &= 0x7F ;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
else if( !Resource_Unicode::ConvertUnicodeToFormat(estring,
|
||||
pstring,
|
||||
max_string) )
|
||||
printf(" Aspect::ToCString.BAD string length %d\n",max_string);
|
||||
#else
|
||||
if( aString.IsAscii() ) {
|
||||
astring = aString; pstring = astring.ToCString();
|
||||
} else {
|
||||
pstring = (Standard_CString) aString.ToExtString();
|
||||
}
|
||||
#endif
|
||||
|
||||
return pstring;
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect::Inverse (const TColStd_Array2OfReal& aMat, TColStd_Array2OfReal& Result) {
|
||||
|
||||
Standard_Integer lr, ur, lc, uc;
|
||||
Standard_Integer i, j, k, l;
|
||||
|
||||
Standard_Boolean BResult = Standard_False;
|
||||
|
||||
lr = aMat.LowerRow ();
|
||||
ur = aMat.UpperRow ();
|
||||
lc = aMat.LowerCol ();
|
||||
uc = aMat.UpperCol ();
|
||||
|
||||
if ( (ur - lr + 1 != 4) || (uc - lc + 1 != 4) ) {
|
||||
#ifdef TRACE
|
||||
cout << "Inverse () : aMat not a 4x4 matrix" << endl << flush;
|
||||
cout << "Inverse returns False => Error\n" << flush;
|
||||
#endif
|
||||
return BResult;
|
||||
}
|
||||
|
||||
lr = Result.LowerRow ();
|
||||
ur = Result.UpperRow ();
|
||||
lc = Result.LowerCol ();
|
||||
uc = Result.UpperCol ();
|
||||
|
||||
if ( (ur - lr + 1 != 4) || (uc - lc + 1 != 4) ) {
|
||||
#ifdef TRACE
|
||||
cout << "Inverse () : Result not a 4x4 matrix" << endl << flush;
|
||||
cout << "Inverse returns False => Error\n" << flush;
|
||||
#endif
|
||||
return BResult;
|
||||
}
|
||||
|
||||
Standard_Integer ip1;
|
||||
|
||||
float a [5][9];
|
||||
float amax, p;
|
||||
int tperm [5][3];
|
||||
int perm = 0;
|
||||
|
||||
for (i=1; i<=4; i++)
|
||||
for (j=1; j<=4; j++) {
|
||||
// a [i][j] = aMat (lr + i - 1, lc + j - 1);
|
||||
a [i][j] = (float ) aMat (lr + i - 1, lc + j - 1);
|
||||
if (i == j) Result (lr + i - 1, lc + j - 1) = 1.;
|
||||
else Result (lr + i - 1, lc + j - 1) = 0.;
|
||||
}
|
||||
for (i=1; i<=4; i++)
|
||||
for (j=5; j<=8; j++)
|
||||
if (i == j-4) a [i][j] = 1.;
|
||||
else a [i][j] = 0.;
|
||||
|
||||
#ifdef TRACE
|
||||
cout << "Matrice :\n";
|
||||
for (i=1; i<=4; i++) {
|
||||
for (j=1; j<=4; j++)
|
||||
cout << a [i][j] << " ";
|
||||
cout << endl;
|
||||
}
|
||||
cout << flush;
|
||||
#endif
|
||||
|
||||
for (i=1; i<=4; i++) {
|
||||
ip1 = i + 1;
|
||||
if (ip1 <= 4) {
|
||||
/* Recherche pivot maximal */
|
||||
l = i;
|
||||
// amax = fabs (a [i][i]);
|
||||
amax = (float ) fabs (a [i][i]);
|
||||
for (k=ip1; k<=4; k++) {
|
||||
if (amax < fabs (a [k][i])) {
|
||||
l = k;
|
||||
// amax = fabs (a [k][i]);
|
||||
amax = (float ) fabs (a [k][i]);
|
||||
} /* if (amax < abs (a [k][i])) */
|
||||
}
|
||||
/* Permutation eventuelle */
|
||||
if (l != i) {
|
||||
#ifdef TRACE
|
||||
cout << "permutation des lignes "
|
||||
<< l << " et " << i << "\n" << flush;
|
||||
#endif
|
||||
perm ++;
|
||||
tperm [perm][1] = l;
|
||||
tperm [perm][2] = i;
|
||||
for (j=1; j<=4; j++) {
|
||||
p = a [i][j];
|
||||
a [i][j] = a [l][j];
|
||||
a [l][j] = p;
|
||||
}
|
||||
} /* if (l != i) */
|
||||
} /* if (ip1 <= 4) */
|
||||
p = a [i][i];
|
||||
if (p == 0.) {
|
||||
#ifdef TRACE
|
||||
cout << "p == 0.\n" << flush;
|
||||
cout << "Inverse returns False => Error\n" << flush;
|
||||
#endif
|
||||
return BResult;
|
||||
}
|
||||
/* Substitution */
|
||||
for (j=1; j<=4; j++)
|
||||
a [i][j] = a [i][j]/p;
|
||||
for (k=1; k<=4; k++)
|
||||
if (k != i)
|
||||
for (j=1; j<=4; j++)
|
||||
if (j != i) a [k][j] = a [k][j] - a [k][i]*a [i][j];
|
||||
for (k=1; k<=4; k++)
|
||||
a [k][i] = - a [k][i]/p;
|
||||
a [i][i] = - a [i][i];
|
||||
} /* for (i=1; i<=4; i++) */
|
||||
|
||||
/* Remise en ordre */
|
||||
for (k=perm; k>0; k--) {
|
||||
#ifdef TRACE
|
||||
cout << "permutation des colonnes "
|
||||
<< tperm[k][1] << " et " << tperm[k][2] << "\n" << flush;
|
||||
#endif
|
||||
for (i=1; i<=4; i++) {
|
||||
p = a [i][tperm[k][1]];
|
||||
a [i][tperm[k][1]] = a [i][tperm[k][2]];
|
||||
a [i][tperm[k][2]] = p;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=1; i<=4; i++)
|
||||
for (j=1; j<=4; j++)
|
||||
Result (lr + i - 1, lc + j - 1) = a [i][j];
|
||||
|
||||
#ifdef TRACE
|
||||
cout << "Inverse :\n";
|
||||
for (i=lr; i<=ur; i++) {
|
||||
for (j=lc; j<=uc; j++)
|
||||
cout << Result (i, j) << " ";
|
||||
cout << endl;
|
||||
}
|
||||
cout << "Inverse returns True => Ok\n" << flush;
|
||||
#endif
|
||||
|
||||
return Standard_True;
|
||||
}
|
201
src/Aspect/Aspect_AspectFillArea.cdl
Executable file
201
src/Aspect/Aspect_AspectFillArea.cdl
Executable file
@@ -0,0 +1,201 @@
|
||||
--
|
||||
-- File: Aspect_AspectFillArea.cdl
|
||||
-- Created: Lundi 4 Novembre 1991
|
||||
-- Author: NW,JPB,CAL
|
||||
-- Modified: 15/01/98 ; FMN : Ajout Hidden Line
|
||||
-- 08/01/03 ; SAV : Added method and field to control back face interior
|
||||
-- color
|
||||
--
|
||||
---Copyright: MatraDatavision 1991,1992,1993,1994
|
||||
--
|
||||
|
||||
deferred class AspectFillArea from Aspect
|
||||
|
||||
---Purpose: Group of attributes for the FACE primitives.
|
||||
-- The attributes are:
|
||||
-- * type of interior
|
||||
-- * type of hatch
|
||||
-- * interior colour
|
||||
-- * border colour
|
||||
-- * type of border
|
||||
-- * thickness of border
|
||||
-- when the value of the group is modified, all graphic
|
||||
-- objects using this group are modified.
|
||||
|
||||
|
||||
inherits
|
||||
|
||||
TShared
|
||||
|
||||
uses
|
||||
|
||||
Color from Quantity,
|
||||
|
||||
HatchStyle from Aspect,
|
||||
InteriorStyle from Aspect,
|
||||
TypeOfLine from Aspect
|
||||
|
||||
raises
|
||||
|
||||
AspectFillAreaDefinitionError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Initialize;
|
||||
---Level: Public
|
||||
---Purpose: Initialise the constructor
|
||||
-- of Graphic3d_AspectFillArea3d.
|
||||
--
|
||||
-- default values :
|
||||
--
|
||||
-- InteriorStyle = Aspect_IS_EMPTY;
|
||||
-- InteriorColor = Quantity_NOC_CYAN1;
|
||||
-- EdgeColor = Quantity_NOC_WHITE;
|
||||
-- EdgeType = Aspect_TOL_SOLID;
|
||||
-- EdgeWidth = 1.0;
|
||||
-- HatchStyle = Aspect_HS_VERTICAL;
|
||||
|
||||
Initialize ( InteriorStyle : InteriorStyle from Aspect;
|
||||
InteriorColor : Color from Quantity;
|
||||
EdgeColor : Color from Quantity;
|
||||
EdgeLineType : TypeOfLine from Aspect;
|
||||
EdgeLineWidth : Real from Standard )
|
||||
---Level: Public
|
||||
---Purpose: Initialise the values for the constructor of
|
||||
-- Graphic3d_AspectFillArea3d.
|
||||
--
|
||||
-- InteriorStyle :
|
||||
-- IS_EMPTY no interior.
|
||||
-- IS_HOLLOW display the boundaries of the surface.
|
||||
-- IS_HATCH display hatched with a hatch style.
|
||||
-- IS_SOLID display the interior entirely filled.
|
||||
--
|
||||
-- EdgeLineType :
|
||||
-- TOL_SOLID continuous
|
||||
-- TOL_DASH dashed
|
||||
-- TOL_DOT dotted
|
||||
-- TOL_DOTDASH mixed
|
||||
--
|
||||
-- default values :
|
||||
-- HatchStyle = Aspect_HS_VERTICAL;
|
||||
--
|
||||
-- Warning: Raises AspectFillAreaDefinitionError if the
|
||||
-- width is a negative value.
|
||||
raises AspectFillAreaDefinitionError from Aspect;
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
SetEdgeColor ( me : mutable;
|
||||
AColor : Color from Quantity );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the colour of the edge of the face
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetEdgeLineType ( me : mutable;
|
||||
AType : TypeOfLine from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the edge line type
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetEdgeWidth ( me : mutable;
|
||||
AWidth : Real from Standard )
|
||||
---Level: Public
|
||||
---Purpose: Modifies the edge thickness
|
||||
--
|
||||
-- Category: Methods to modify the class definition
|
||||
--
|
||||
-- Warning: Raises AspectFillAreaDefinitionError if the
|
||||
-- width is a negative value.
|
||||
raises AspectFillAreaDefinitionError from Aspect;
|
||||
|
||||
SetHatchStyle ( me : mutable;
|
||||
AStyle : HatchStyle from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the hatch type used when InteriorStyle
|
||||
-- is IS_HATCH
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetInteriorColor ( me : mutable;
|
||||
AColor : Color from Quantity );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the colour of the interior of the face
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackInteriorColor( me : mutable; color : Color from Quantity );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the colour of the interior of the back face
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetInteriorStyle ( me : mutable;
|
||||
AStyle : InteriorStyle from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the interior type used for rendering
|
||||
--
|
||||
-- InteriorStyle : IS_EMPTY no interior
|
||||
-- IS_HOLLOW display the boundaries of the surface
|
||||
-- IS_HATCH display hatching
|
||||
-- IS_SOLID display interior entirely filled
|
||||
--
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
HatchStyle ( me )
|
||||
returns HatchStyle from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns the hatch type used when InteriorStyle
|
||||
-- is IS_HATCH
|
||||
---Category: Inquire methods
|
||||
|
||||
Values ( me;
|
||||
AStyle : out InteriorStyle from Aspect;
|
||||
AIntColor : out Color from Quantity;
|
||||
AEdgeColor : out Color from Quantity;
|
||||
AType : out TypeOfLine from Aspect;
|
||||
AWidth : out Real from Standard );
|
||||
|
||||
Values ( me;
|
||||
AStyle : out InteriorStyle from Aspect;
|
||||
AIntColor : out Color from Quantity;
|
||||
BackIntColor : out Color from Quantity;
|
||||
AEdgeColor : out Color from Quantity;
|
||||
AType : out TypeOfLine from Aspect;
|
||||
AWidth : out Real from Standard );
|
||||
---Level: Public
|
||||
---Purpose: Returns the current values of the <me> group.
|
||||
---Category: Inquire methods
|
||||
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
--
|
||||
-- Class : Aspect_AspectFillArea
|
||||
--
|
||||
-- Purpose : Declaration of specific variables in the context of
|
||||
-- drawing faces
|
||||
--
|
||||
-- Reminder : The drawing context of a face is defined by:
|
||||
-- - the interior style and color of the face
|
||||
-- - the style, color and thickness of the face edge
|
||||
--
|
||||
|
||||
-- the interior
|
||||
MyInteriorStyle : InteriorStyle from Aspect;
|
||||
MyInteriorColor : Color from Quantity;
|
||||
|
||||
MyBackInteriorColor : Color from Quantity;
|
||||
|
||||
-- the edge
|
||||
MyEdgeColor : Color from Quantity;
|
||||
MyEdgeType : TypeOfLine from Aspect;
|
||||
MyEdgeWidth : Real from Standard;
|
||||
|
||||
-- the hatch
|
||||
MyHatchStyle : HatchStyle from Aspect;
|
||||
|
||||
end AspectFillArea;
|
156
src/Aspect/Aspect_AspectFillArea.cxx
Executable file
156
src/Aspect/Aspect_AspectFillArea.cxx
Executable file
@@ -0,0 +1,156 @@
|
||||
|
||||
// File Aspect_AspectFillArea.cxx
|
||||
// Created Mars 1992
|
||||
// Author NW,JPB,CAL
|
||||
// Modified: 15/01/98 ; FMN : Ajout Hidden Line
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques au contexte
|
||||
// de trace des facettes
|
||||
|
||||
//-Warning Un contexte de trace de facette est defini par :
|
||||
// - le style de l'interieur de la facette
|
||||
// - le style du bord de la facette
|
||||
// - la couleur
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_AspectFillArea.ixx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// -- l'interieur
|
||||
// MyInteriorStyle : InteriorStyle;
|
||||
// MyInteriorColor : Color;
|
||||
|
||||
// -- le bord
|
||||
// MyEdgeColor : Color;
|
||||
// MyEdgeType : TypeOfLine;
|
||||
// MyEdgeWidth : Standard_Real;
|
||||
|
||||
// -- les hachures
|
||||
// MyHatchStyle : HatchStyle;
|
||||
|
||||
|
||||
#define OCC1174 // SAV : 08/01/03 Added back face interior color
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_AspectFillArea::Aspect_AspectFillArea () {
|
||||
|
||||
MyInteriorStyle = Aspect_IS_EMPTY;
|
||||
MyInteriorColor = Quantity_NOC_CYAN1;
|
||||
#ifdef OCC1174
|
||||
MyBackInteriorColor = Quantity_NOC_CYAN1;
|
||||
#endif
|
||||
MyEdgeColor = Quantity_NOC_WHITE;
|
||||
MyEdgeType = Aspect_TOL_SOLID;
|
||||
MyEdgeWidth = 1.0;
|
||||
MyHatchStyle = Aspect_HS_VERTICAL;
|
||||
|
||||
}
|
||||
|
||||
Aspect_AspectFillArea::Aspect_AspectFillArea (const Aspect_InteriorStyle InteriorStyle, const Quantity_Color& InteriorColor, const Quantity_Color& EdgeColor, const Aspect_TypeOfLine EdgeLineType, const Standard_Real EdgeLineWidth) {
|
||||
|
||||
if (EdgeLineWidth <= 0.0)
|
||||
Aspect_AspectFillAreaDefinitionError::Raise
|
||||
("Bad value for EdgeLineWidth");
|
||||
|
||||
MyInteriorStyle = InteriorStyle;
|
||||
MyInteriorColor = InteriorColor;
|
||||
MyEdgeColor = EdgeColor;
|
||||
MyEdgeType = EdgeLineType;
|
||||
MyEdgeWidth = EdgeLineWidth;
|
||||
MyHatchStyle = Aspect_HS_VERTICAL;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectFillArea::SetInteriorStyle (const Aspect_InteriorStyle AStyle) {
|
||||
|
||||
MyInteriorStyle = AStyle;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectFillArea::SetInteriorColor (const Quantity_Color& AColor) {
|
||||
|
||||
MyInteriorColor = AColor;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectFillArea::SetBackInteriorColor( const Quantity_Color& color )
|
||||
{
|
||||
#ifdef OCC1174
|
||||
MyBackInteriorColor = color;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Aspect_AspectFillArea::SetEdgeColor (const Quantity_Color& AColor) {
|
||||
|
||||
MyEdgeColor = AColor;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectFillArea::SetEdgeLineType (const Aspect_TypeOfLine AType) {
|
||||
|
||||
MyEdgeType = AType;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectFillArea::SetEdgeWidth (const Standard_Real AWidth) {
|
||||
|
||||
if (AWidth <= 0.0)
|
||||
Aspect_AspectFillAreaDefinitionError::Raise
|
||||
("Bad value for EdgeLineWidth");
|
||||
|
||||
MyEdgeWidth = AWidth;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectFillArea::SetHatchStyle (const Aspect_HatchStyle AStyle) {
|
||||
|
||||
MyHatchStyle = AStyle;
|
||||
|
||||
}
|
||||
|
||||
Aspect_HatchStyle Aspect_AspectFillArea::HatchStyle () const {
|
||||
|
||||
return (MyHatchStyle);
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectFillArea::Values (Aspect_InteriorStyle& AStyle, Quantity_Color& AIntColor, Quantity_Color& AEdgeColor, Aspect_TypeOfLine& AType, Standard_Real& AWidth) const {
|
||||
|
||||
AStyle = MyInteriorStyle;
|
||||
AIntColor = MyInteriorColor;
|
||||
AEdgeColor = MyEdgeColor;
|
||||
AType = MyEdgeType;
|
||||
AWidth = MyEdgeWidth;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectFillArea::Values (Aspect_InteriorStyle& AStyle, Quantity_Color& AIntColor, Quantity_Color& BackIntColor, Quantity_Color& AEdgeColor, Aspect_TypeOfLine& AType, Standard_Real& AWidth) const {
|
||||
|
||||
AStyle = MyInteriorStyle;
|
||||
AIntColor = MyInteriorColor;
|
||||
#ifdef OCC1174
|
||||
BackIntColor = MyBackInteriorColor;
|
||||
#endif
|
||||
AEdgeColor = MyEdgeColor;
|
||||
AType = MyEdgeType;
|
||||
AWidth = MyEdgeWidth;
|
||||
|
||||
}
|
118
src/Aspect/Aspect_AspectLine.cdl
Executable file
118
src/Aspect/Aspect_AspectLine.cdl
Executable file
@@ -0,0 +1,118 @@
|
||||
--
|
||||
-- File: Aspect_AspectLine.cdl
|
||||
-- Created: Jeudi 22 Aout 1991
|
||||
-- Author: NW,JPB,CAL
|
||||
--
|
||||
---Copyright: MatraDatavision 1991,1992,1993,1994
|
||||
--
|
||||
|
||||
deferred class AspectLine from Aspect
|
||||
|
||||
inherits
|
||||
|
||||
TShared
|
||||
|
||||
---Purpose: This class allows the definition of a group
|
||||
-- of attributes for the LINE primitive
|
||||
-- The attributes are:
|
||||
-- * Colour
|
||||
-- * Type
|
||||
-- * Thickness
|
||||
-- When any value of the group is modified
|
||||
-- all graphic objects using the group are modified.
|
||||
|
||||
uses
|
||||
|
||||
Color from Quantity,
|
||||
|
||||
TypeOfLine from Aspect
|
||||
|
||||
raises
|
||||
|
||||
AspectLineDefinitionError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Initialize;
|
||||
---Level: Public
|
||||
---Purpose: Initialise the constructor for Graphic3d_AspectLine3d.
|
||||
--
|
||||
-- Default values :
|
||||
-- Color = Quantity_NOC_YELLOW;
|
||||
-- Type = Aspect_TOL_SOLID;
|
||||
-- Width = 1.0;
|
||||
--
|
||||
|
||||
Initialize ( AColor : Color from Quantity;
|
||||
AType : TypeOfLine from Aspect;
|
||||
AWidth : Real from Standard )
|
||||
---Level: Public
|
||||
---Purpose: Initialise the values for the
|
||||
-- constructor of Graphic3d_AspectLine3d.
|
||||
--
|
||||
raises AspectLineDefinitionError from Aspect;
|
||||
-- if the width is a negative value.
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
SetColor ( me : mutable;
|
||||
AColor : Color from Quantity );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the colour of <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetType ( me : mutable;
|
||||
AType : TypeOfLine from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the type of <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetWidth ( me : mutable;
|
||||
AWidth : Real from Standard )
|
||||
---Level: Public
|
||||
---Purpose: Modifies the thickness of <me>.
|
||||
-- Category: Methods to modify the class definition
|
||||
-- Warning: Raises AspectLineDefinitionError if the
|
||||
-- width is a negative value.
|
||||
raises AspectLineDefinitionError from Aspect;
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
Values ( me;
|
||||
AColor : out Color from Quantity;
|
||||
AType : out TypeOfLine from Aspect;
|
||||
AWidth : out Real from Standard );
|
||||
---Level: Public
|
||||
---Purpose: Returns the current values of the group <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
--
|
||||
-- Class : Aspect_AspectLine
|
||||
--
|
||||
-- Purpose : Declaration of variables specific to
|
||||
-- drawing lines
|
||||
--
|
||||
-- Reminder : A line drawing context is defined by:
|
||||
-- - the colour
|
||||
-- - the type
|
||||
-- - the thickness
|
||||
--
|
||||
|
||||
-- the colour
|
||||
MyColor : Color from Quantity;
|
||||
|
||||
-- the type
|
||||
MyType : TypeOfLine from Aspect;
|
||||
|
||||
-- the thickness
|
||||
MyWidth : Real from Standard;
|
||||
|
||||
end AspectLine;
|
94
src/Aspect/Aspect_AspectLine.cxx
Executable file
94
src/Aspect/Aspect_AspectLine.cxx
Executable file
@@ -0,0 +1,94 @@
|
||||
|
||||
// File Aspect_AspectLine.cxx
|
||||
// Created Mars 1992
|
||||
// Author NW,JPB,CAL
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques au contexte
|
||||
// de trace de lignes
|
||||
|
||||
//-Warning Un contexte de trace de ligne est defini par :
|
||||
// - la couleur
|
||||
// - le type de trait
|
||||
// - l'epaisseur
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_AspectLine.ixx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// -- la couleur
|
||||
// MyColor : Color;
|
||||
|
||||
// -- le type de trait
|
||||
// MyType : TypeOfLine;
|
||||
|
||||
// -- l'epaisseur
|
||||
// MyWidth : Standard_Real;
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_AspectLine::Aspect_AspectLine () {
|
||||
|
||||
MyColor = Quantity_NOC_YELLOW;
|
||||
MyType = Aspect_TOL_SOLID;
|
||||
MyWidth = 1.0;
|
||||
|
||||
}
|
||||
|
||||
Aspect_AspectLine::Aspect_AspectLine (const Quantity_Color& AColor, const Aspect_TypeOfLine AType, const Standard_Real AWidth) {
|
||||
|
||||
if (AWidth <= 0.0)
|
||||
Aspect_AspectLineDefinitionError::Raise
|
||||
("Bad value for LineWidth");
|
||||
|
||||
MyColor = AColor;
|
||||
MyType = AType;
|
||||
MyWidth = AWidth;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectLine::SetColor (const Quantity_Color& AColor) {
|
||||
|
||||
MyColor = AColor;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectLine::SetType (const Aspect_TypeOfLine AType) {
|
||||
|
||||
MyType = AType;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectLine::SetWidth (const Standard_Real AWidth) {
|
||||
|
||||
if (AWidth <= 0.0)
|
||||
Aspect_AspectLineDefinitionError::Raise
|
||||
("Bad value for LineWidth");
|
||||
|
||||
MyWidth = AWidth;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectLine::Values (Quantity_Color& AColor, Aspect_TypeOfLine& AType, Standard_Real& AWidth) const {
|
||||
|
||||
AColor = MyColor;
|
||||
AType = MyType;
|
||||
AWidth = MyWidth;
|
||||
|
||||
}
|
120
src/Aspect/Aspect_AspectMarker.cdl
Executable file
120
src/Aspect/Aspect_AspectMarker.cdl
Executable file
@@ -0,0 +1,120 @@
|
||||
--
|
||||
-- File: Aspect_AspectMarker.cdl
|
||||
-- Created: Lundi 2 Septembre 1991
|
||||
-- Author: NW,JPB,CAL
|
||||
--
|
||||
---Copyright: MatraDatavision 1991,1992,1993,1994
|
||||
--
|
||||
|
||||
deferred class AspectMarker from Aspect
|
||||
|
||||
inherits
|
||||
|
||||
TShared
|
||||
|
||||
---Purpose: This class allows the definition of a group
|
||||
-- of attributes for the primitive MARKER.
|
||||
-- the attributes are:
|
||||
-- * Colour
|
||||
-- * Type
|
||||
-- * Scale factor
|
||||
-- When any value of the group is modified
|
||||
-- all graphic objects using the group are modified
|
||||
|
||||
uses
|
||||
|
||||
Color from Quantity,
|
||||
|
||||
TypeOfMarker from Aspect
|
||||
|
||||
raises
|
||||
|
||||
AspectMarkerDefinitionError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Initialize;
|
||||
---Level: Public
|
||||
---Purpose: Initialise the constructor for Graphic3d_AspectMarker3d.
|
||||
--
|
||||
-- defaults values :
|
||||
--
|
||||
-- Color = Quantity_NOC_YELLOW;
|
||||
-- Type = Aspect_TOM_X;
|
||||
-- Scale = 1.0;
|
||||
|
||||
Initialize ( AColor : Color from Quantity;
|
||||
AType : TypeOfMarker from Aspect;
|
||||
AScale : Real from Standard )
|
||||
---Level: Public
|
||||
---Purpose: Initialise the values for the
|
||||
-- constructor of Graphic3d_AspectMarker3d.
|
||||
-- Warning: Raises AspectMarkerDefinitionError if the
|
||||
-- scale is a negative value.
|
||||
raises AspectMarkerDefinitionError from Aspect;
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
SetColor ( me : mutable;
|
||||
AColor : Color from Quantity );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the colour of <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetScale ( me : mutable;
|
||||
AScale : Real from Standard )
|
||||
---Level: Public
|
||||
---Purpose: Modifies the scale factor of <me>.
|
||||
-- Marker type Aspect_TOM_POINT is not affected
|
||||
-- by the marker size scale factor. It is always
|
||||
-- the smallest displayable dot.
|
||||
-- Warning: Raises AspectMarkerDefinitionError if the
|
||||
-- scale is a negative value.
|
||||
raises AspectMarkerDefinitionError from Aspect;
|
||||
|
||||
SetType ( me : mutable;
|
||||
AType : TypeOfMarker from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the type of marker <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
Values ( me;
|
||||
AColor : out Color from Quantity;
|
||||
AType : out TypeOfMarker from Aspect;
|
||||
AScale : out Real from Standard );
|
||||
---Level: Public
|
||||
---Purpose: Returns the current values of the group <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
--
|
||||
-- Class : Aspect_AspectMarker
|
||||
--
|
||||
-- Purpose : Declaration of variables specific to the context of
|
||||
-- drawing markers
|
||||
--
|
||||
-- Reminder : A drawing context for markers is defined by :
|
||||
-- - the colour
|
||||
-- - the type
|
||||
-- - the scale
|
||||
--
|
||||
|
||||
-- the colour
|
||||
MyColor : Color from Quantity;
|
||||
|
||||
-- the type
|
||||
MyType : TypeOfMarker from Aspect;
|
||||
|
||||
-- the scale
|
||||
MyScale : Real from Standard;
|
||||
|
||||
end AspectMarker;
|
94
src/Aspect/Aspect_AspectMarker.cxx
Executable file
94
src/Aspect/Aspect_AspectMarker.cxx
Executable file
@@ -0,0 +1,94 @@
|
||||
|
||||
// File Aspect_AspectMarker.cxx
|
||||
// Created Fevrier 1992
|
||||
// Author NW,JPB,CAL
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques au contexte
|
||||
// de trace de markers
|
||||
|
||||
//-Warning Un contexte de trace de marker est defini par :
|
||||
// - la couleur
|
||||
// - le type
|
||||
// - l'echelle
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_AspectMarker.ixx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// -- la couleur
|
||||
// MyColor : Color;
|
||||
|
||||
// -- le type
|
||||
// MyType : TypeOfMarker;
|
||||
|
||||
// -- l'echelle
|
||||
// MyScale : Standard_Real;
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_AspectMarker::Aspect_AspectMarker () {
|
||||
|
||||
MyColor = Quantity_NOC_YELLOW;
|
||||
MyType = Aspect_TOM_X;
|
||||
MyScale = 1.0;
|
||||
|
||||
}
|
||||
|
||||
Aspect_AspectMarker::Aspect_AspectMarker (const Quantity_Color& AColor, const Aspect_TypeOfMarker AType, const Standard_Real AScale) {
|
||||
|
||||
if (AScale <= 0.0)
|
||||
Aspect_AspectMarkerDefinitionError::Raise
|
||||
("Bad value for MarkerScale");
|
||||
|
||||
MyColor = AColor;
|
||||
MyType = AType;
|
||||
MyScale = AScale;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectMarker::SetColor (const Quantity_Color& AColor) {
|
||||
|
||||
MyColor = AColor;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectMarker::SetType (const Aspect_TypeOfMarker AType) {
|
||||
|
||||
MyType = AType;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectMarker::SetScale (const Standard_Real AScale) {
|
||||
|
||||
if (AScale <= 0.0)
|
||||
Aspect_AspectMarkerDefinitionError::Raise
|
||||
("Bad value for MarkerScale");
|
||||
|
||||
MyScale = AScale;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_AspectMarker::Values (Quantity_Color& AColor, Aspect_TypeOfMarker& AType, Standard_Real& AScale) const {
|
||||
|
||||
AColor = MyColor;
|
||||
AType = MyType;
|
||||
AScale = MyScale;
|
||||
|
||||
}
|
68
src/Aspect/Aspect_Background.cdl
Executable file
68
src/Aspect/Aspect_Background.cdl
Executable file
@@ -0,0 +1,68 @@
|
||||
--
|
||||
-- File: Aspect_Background.cdl
|
||||
-- Created: Mercredi 2 Octobre 1991
|
||||
-- Author: NW,JPB,CAL
|
||||
--
|
||||
---Copyright: MatraDatavision 1991,1992,1993
|
||||
--
|
||||
|
||||
class Background from Aspect
|
||||
|
||||
|
||||
---Purpose: This class allows the definition of
|
||||
-- a window background.
|
||||
|
||||
uses
|
||||
|
||||
Color from Quantity
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns Background from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates a window background.
|
||||
-- Default color : NOC_MATRAGRAY.
|
||||
|
||||
Create ( AColor : Color from Quantity )
|
||||
returns Background from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates a window background with the colour <AColor>.
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
SetColor ( me : in out;
|
||||
AColor : Color from Quantity );
|
||||
---Level: Public
|
||||
---Purpose: Modifies the colour of the window background <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
Color ( me )
|
||||
returns Color from Quantity;
|
||||
---Level: Public
|
||||
---Purpose: Returns the colour of the window background <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
--
|
||||
-- Class : Aspect_Background
|
||||
--
|
||||
-- Purpose : Declaration of variables specific to the window
|
||||
-- background.
|
||||
--
|
||||
-- Reminder : A background is defined by one colour
|
||||
--
|
||||
|
||||
-- the colour associated with the window background
|
||||
MyColor : Color from Quantity;
|
||||
|
||||
end Background;
|
60
src/Aspect/Aspect_Background.cxx
Executable file
60
src/Aspect/Aspect_Background.cxx
Executable file
@@ -0,0 +1,60 @@
|
||||
|
||||
// File Aspect_Background.cxx
|
||||
// Created Fevrier 1992
|
||||
// Author NW,JPB,CAL
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux fonds d'ecran.
|
||||
|
||||
//-Warning Un fond d'ecran est defini par une couleur.
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_Background.ixx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// -- la couleur associee au fond d'ecran
|
||||
// MyColor : Color;
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_Background::Aspect_Background () {
|
||||
|
||||
Quantity_Color MatraGray (Quantity_NOC_MATRAGRAY);
|
||||
|
||||
MyColor = MatraGray;
|
||||
|
||||
}
|
||||
|
||||
Aspect_Background::Aspect_Background (const Quantity_Color& AColor) {
|
||||
|
||||
MyColor = AColor;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_Background::SetColor (const Quantity_Color& AColor) {
|
||||
|
||||
MyColor = AColor;
|
||||
|
||||
}
|
||||
|
||||
Quantity_Color Aspect_Background::Color () const {
|
||||
|
||||
return (MyColor);
|
||||
|
||||
}
|
7
src/Aspect/Aspect_CLayer2d.cxx
Executable file
7
src/Aspect/Aspect_CLayer2d.cxx
Executable file
@@ -0,0 +1,7 @@
|
||||
#include <Aspect_CLayer2d.hxx>
|
||||
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_CLayer2d)
|
||||
{
|
||||
static Handle(Standard_Type) _atype = new Standard_Type ("Aspect_CLayer2d", sizeof (Aspect_CLayer2d));
|
||||
return _atype;
|
||||
}
|
22
src/Aspect/Aspect_CLayer2d.hxx
Executable file
22
src/Aspect/Aspect_CLayer2d.hxx
Executable file
@@ -0,0 +1,22 @@
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Aspect_CLayer2d.hxx */
|
||||
/*==== Role : The header file of primitive type "CLayer2d" from Aspect */
|
||||
/*==== */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
/*============================================================================*/
|
||||
|
||||
#ifndef _Aspect_CLayer2d_HeaderFile
|
||||
#define _Aspect_CLayer2d_HeaderFile
|
||||
|
||||
#include <InterfaceGraphic_Aspect.hxx>
|
||||
typedef CALL_DEF_LAYER Aspect_CLayer2d;
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
/*==== Definition de Type ====================================================*/
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
const Handle(Standard_Type)& TYPE(Aspect_CLayer2d) ;
|
||||
/*============================================================================*/
|
||||
|
||||
#endif
|
||||
#endif /*Aspect_CLayer2d_HeaderFile*/
|
17
src/Aspect/Aspect_CMPLRS.edl
Executable file
17
src/Aspect/Aspect_CMPLRS.edl
Executable file
@@ -0,0 +1,17 @@
|
||||
--
|
||||
-- File: Aspect_CMPLRS.edl
|
||||
-- Author: Stephane Callegari
|
||||
-- History: 17 avril 1997 Stephane Callegari Creation
|
||||
-- 03-06-98 BGN: (S3553) portage MFT sur NT.
|
||||
-- Copyright: Matra Datavision 1997
|
||||
--
|
||||
@ifnotdefined ( %Aspect_CMPLRS_EDL) then
|
||||
@set %Aspect_CMPLRS_EDL = "";
|
||||
|
||||
@if ( %Station == "wnt" ) then
|
||||
--- @set %CModeOpt = "-Zi -O2 -DNDEBUG -G5 -Oi";
|
||||
@string %CMPLRS_CXX_Options = %CMPLRS_CXX_Options " -D_AFXDLL ";
|
||||
@endif;
|
||||
|
||||
@endif;
|
||||
|
85
src/Aspect/Aspect_CircularGrid.cdl
Executable file
85
src/Aspect/Aspect_CircularGrid.cdl
Executable file
@@ -0,0 +1,85 @@
|
||||
-- File: Aspect_CircularGrid.cdl
|
||||
-- Created: Fri Mar 17 08:21:04 1995
|
||||
-- Author: Mister rmi
|
||||
-- <rmi@pernox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
class CircularGrid from Aspect
|
||||
|
||||
inherits Grid from Aspect
|
||||
|
||||
|
||||
uses
|
||||
PlaneAngle, Length from Quantity
|
||||
|
||||
raises
|
||||
NegativeValue,NullValue,NumericError from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(aRadiusStep: Length from Quantity;
|
||||
aDivisionNumber: Integer from Standard;
|
||||
XOrigin: Length from Quantity = 0;
|
||||
anYOrigin: Length from Quantity = 0;
|
||||
aRotationAngle: PlaneAngle from Quantity = 0)
|
||||
returns mutable CircularGrid from Aspect;
|
||||
---Purpose: creates a new grid. By default this grid is not
|
||||
-- active.
|
||||
|
||||
---Category: grid definition methods
|
||||
|
||||
|
||||
SetRadiusStep(me: mutable; aStep: Length from Quantity)
|
||||
---Purpose: defines the x step of the grid.
|
||||
raises NegativeValue,NullValue from Standard
|
||||
---Warning: raises an exception if <aStep> is not strictly positive.
|
||||
is static;
|
||||
|
||||
SetDivisionNumber(me: mutable; aNumber: Integer from Standard)
|
||||
---Purpose: defines the step of the grid.
|
||||
raises NegativeValue,NullValue from Standard
|
||||
---Warning: raises an exception if <aNumber> is not strictly positive.
|
||||
is static;
|
||||
|
||||
SetGridValues(me: mutable; XOrigin, YOrigin: Length from Quantity;
|
||||
RadiusStep: Length from Quantity;
|
||||
DivisionNumber: Integer from Standard;
|
||||
RotationAngle: PlaneAngle from Quantity)
|
||||
raises NegativeValue,NullValue from Standard
|
||||
---Warning: raises an exception if <RadiusStep> is not strictly positive.
|
||||
---Warning: raises an exception if <DivisionNumber> is not strictly positive.
|
||||
is static;
|
||||
|
||||
|
||||
---Category: Pick methods
|
||||
--
|
||||
Compute(me; X,Y: Length from Quantity; gridX, gridY : out Length from Quantity)
|
||||
---Purpose: returns the point of the grid the closest to the point X,Y
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
---Category: inquire methods
|
||||
|
||||
RadiusStep(me) returns Length from Quantity
|
||||
---Purpose: returns the x step of the grid.
|
||||
is static;
|
||||
|
||||
DivisionNumber(me) returns Integer from Standard
|
||||
---Purpose: returns the x step of the grid.
|
||||
is static;
|
||||
|
||||
---Category: private methods.
|
||||
|
||||
|
||||
Init(me: mutable)
|
||||
is redefined static;
|
||||
|
||||
fields
|
||||
|
||||
myRadiusStep: Length from Quantity;
|
||||
myDivisionNumber: Integer from Standard;
|
||||
myAlpha: Real from Standard;
|
||||
myA1,myB1: Real from Standard;
|
||||
|
||||
end CircularGrid from Aspect;
|
154
src/Aspect/Aspect_CircularGrid.cxx
Executable file
154
src/Aspect/Aspect_CircularGrid.cxx
Executable file
@@ -0,0 +1,154 @@
|
||||
// Modified 23/02/98 : FMN ; Remplacement PI par Standard_PI
|
||||
|
||||
#define CSR577 //GG 25/09/00 Avoid to have unaccuracy coordinates computation
|
||||
// when the grid is activated.
|
||||
|
||||
#define OCC192_193 // jfa 27/02/2002
|
||||
// for big rotation angles - error of negative values expression in round numbers
|
||||
|
||||
#define xTRACE
|
||||
|
||||
#include <Aspect_CircularGrid.ixx>
|
||||
#include <Aspect_Grid.hxx>
|
||||
#include <Standard_NumericError.hxx>
|
||||
Aspect_CircularGrid::Aspect_CircularGrid
|
||||
(const Quantity_Length aRadiusStep,
|
||||
const Standard_Integer aDivisionNumber,
|
||||
const Quantity_Length anXOrigin,
|
||||
const Quantity_Length anYOrigin,
|
||||
const Quantity_PlaneAngle aRotationAngle)
|
||||
:Aspect_Grid(anXOrigin,anYOrigin,aRotationAngle),myRadiusStep(aRadiusStep),
|
||||
myDivisionNumber(aDivisionNumber) {
|
||||
}
|
||||
|
||||
void Aspect_CircularGrid::SetRadiusStep(const Standard_Real aRadiusStep) {
|
||||
Standard_NegativeValue_Raise_if(aRadiusStep < 0., "invalid radius step");
|
||||
Standard_NullValue_Raise_if(aRadiusStep == 0. , "invalid radius step");
|
||||
myRadiusStep= aRadiusStep;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
void Aspect_CircularGrid::SetDivisionNumber(const Standard_Integer aNumber) {
|
||||
Standard_NegativeValue_Raise_if(aNumber < 0., "invalid division number");
|
||||
Standard_NullValue_Raise_if(aNumber == 0. , "invalid division number");
|
||||
myDivisionNumber = aNumber;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
void Aspect_CircularGrid::SetGridValues
|
||||
(const Quantity_Length theXOrigin,
|
||||
const Quantity_Length theYOrigin,
|
||||
const Quantity_Length theRadiusStep,
|
||||
const Standard_Integer theDivisionNumber,
|
||||
const Quantity_PlaneAngle theRotationAngle) {
|
||||
myXOrigin = theXOrigin;
|
||||
myYOrigin = theYOrigin;
|
||||
Standard_NegativeValue_Raise_if(theRadiusStep < 0., "invalid radius step");
|
||||
Standard_NullValue_Raise_if(theRadiusStep == 0. , "invalid radius step");
|
||||
myRadiusStep= theRadiusStep;
|
||||
Standard_NegativeValue_Raise_if(theDivisionNumber < 0., "invalid division number");
|
||||
Standard_NullValue_Raise_if(theDivisionNumber == 0. , "invalid division number");
|
||||
myDivisionNumber = theDivisionNumber;
|
||||
myRotationAngle = theRotationAngle;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
void Aspect_CircularGrid::Compute(const Quantity_Length X,
|
||||
const Quantity_Length Y,
|
||||
Quantity_Length& gridX,
|
||||
Quantity_Length& gridY) const {
|
||||
|
||||
#ifdef TRACE
|
||||
if( X == 0. || Y == 0. ) {
|
||||
cout << " Aspect_CircularGrid" << endl;
|
||||
}
|
||||
#endif
|
||||
Standard_Real xo = XOrigin();
|
||||
Standard_Real yo = YOrigin();
|
||||
Standard_Real d = Sqrt( (xo-X)*(xo-X) + (yo-Y)*(yo-Y) );
|
||||
Standard_Integer n = (Standard_Integer ) ( d/myRadiusStep + 0.5 ) ;
|
||||
Standard_Real radius = Standard_Real(n) * myRadiusStep;
|
||||
Standard_Real cosinus = (X-xo)/d;
|
||||
Standard_Real a = ACos(cosinus);
|
||||
Standard_Real ra = RotationAngle();
|
||||
if ( Y < yo ) a = 2*Standard_PI - a;
|
||||
#ifdef OCC192_193
|
||||
n = (Standard_Integer ) ((a-ra)/myAlpha + Sign(0.5, a-ra)) ;
|
||||
#else
|
||||
n = (Standard_Integer ) ((a-ra)/myAlpha +0.5 ) ;
|
||||
#endif
|
||||
|
||||
#ifdef CSR577
|
||||
Standard_Real cs=0,sn=0;
|
||||
Standard_Boolean done = Standard_False;
|
||||
Standard_Integer nmax = 2*myDivisionNumber;
|
||||
Standard_Integer nquad,qmax;
|
||||
|
||||
if( ra == 0. ) {
|
||||
nquad = 4; qmax = nmax/nquad;
|
||||
if( (n == 0) || (!(nmax % nquad) && !(n % qmax)) ) {
|
||||
Standard_Integer q = n/qmax;
|
||||
switch (q) {
|
||||
default:
|
||||
case 0:
|
||||
cs = 1.; sn = 0.;
|
||||
break;
|
||||
case 1:
|
||||
cs = 0.; sn = 1.;
|
||||
break;
|
||||
case 2:
|
||||
cs = -1.; sn = 0.;
|
||||
break;
|
||||
case 3:
|
||||
cs = 0.; sn = -1.;
|
||||
break;
|
||||
}
|
||||
done = Standard_True;
|
||||
} else {
|
||||
nquad = 2; qmax = nmax/nquad;
|
||||
if( !(nmax % nquad) && !(n % qmax) ) {
|
||||
Standard_Integer q = n/qmax;
|
||||
switch (q) {
|
||||
default:
|
||||
case 0:
|
||||
cs = 1.; sn = 0.;
|
||||
break;
|
||||
case 1:
|
||||
cs = -1.; sn = 0.;
|
||||
break;
|
||||
}
|
||||
done = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !done ) {
|
||||
Standard_Real ang = ra + Standard_Real(n)*myAlpha;
|
||||
cs = Cos(ang); sn = Sin(ang);
|
||||
}
|
||||
#else
|
||||
Standard_Real ang = RotationAngle()+ Standard_Real(n)*myAlpha;
|
||||
Standard_Real cs = Cos(ang);
|
||||
Standard_Real sn = Sin(ang);
|
||||
#endif
|
||||
gridX = xo + cs * radius;
|
||||
gridY = yo + sn * radius;
|
||||
#ifdef TRACE
|
||||
cout << "Aspect_CircularGrid::Compute (" << Quantity_Length (X) << ", "
|
||||
<< Quantity_Length (Y) << ", " << Quantity_Length (gridX) << ", "
|
||||
<< Quantity_Length (gridY) << ")" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
Quantity_Length Aspect_CircularGrid::RadiusStep() const {
|
||||
return myRadiusStep;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_CircularGrid::DivisionNumber () const {
|
||||
return myDivisionNumber;
|
||||
}
|
||||
|
||||
void Aspect_CircularGrid::Init () {
|
||||
myAlpha = Standard_PI /Standard_Real(myDivisionNumber);
|
||||
myA1 = Cos(myAlpha); myB1=Sin(myAlpha);
|
||||
}
|
86
src/Aspect/Aspect_ColorCubeColorMap.cdl
Executable file
86
src/Aspect/Aspect_ColorCubeColorMap.cdl
Executable file
@@ -0,0 +1,86 @@
|
||||
--
|
||||
-- File: Aspect_ColorCubeColorMap.cdl
|
||||
-- Created: 23/03/93
|
||||
-- Author: BBL
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
class ColorCubeColorMap from Aspect inherits ColorMap from Aspect
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a ColorCube ColorMap object.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
Color from Quantity,
|
||||
ColorMapEntry from Aspect
|
||||
|
||||
raises
|
||||
BadAccess from Aspect,
|
||||
RangeError from Standard
|
||||
|
||||
is
|
||||
Create( base_pixel, redmax, redmult,
|
||||
greenmax, greenmult,
|
||||
bluemax, bluemult : in Integer from Standard )
|
||||
returns mutable ColorCubeColorMap from Aspect
|
||||
raises RangeError from Standard ;
|
||||
---Level: Public
|
||||
---Purpose : Create a ColorCube ColorMap.
|
||||
|
||||
ColorCubeDefinition( me : in ;
|
||||
base_pixel,
|
||||
redmax, redmult,
|
||||
greenmax, greenmult,
|
||||
bluemax, bluemult : out Integer from Standard );
|
||||
|
||||
FindColorMapIndex ( me ;
|
||||
AColorMapEntryIndex : Integer from Standard )
|
||||
returns Integer from Standard
|
||||
raises BadAccess from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the index in the ColorMap of the
|
||||
-- ColorMapEntry.Index() equal to <AnEntryIndex>.
|
||||
-- Warning: Raises BadAccess if the index is not defined in the
|
||||
-- ColorMap.
|
||||
|
||||
FindEntry ( me ; AColorMapEntryIndex : Integer from Standard )
|
||||
returns ColorMapEntry from Aspect
|
||||
raises BadAccess from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the ColorMapEntry with ColorMapEntry.Index()
|
||||
-- equal to <AnEntryIndex>.
|
||||
-- Warning: Raises BadAccess if the index is not defined in the
|
||||
-- ColorMap.
|
||||
---C++: return const &
|
||||
|
||||
NearestColorMapIndex( me ; aColor : Color from Quantity )
|
||||
returns Integer from Standard ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the index in the ColorMap of the nearest
|
||||
-- matching ColorMapEntry
|
||||
|
||||
NearestEntry( me ; aColor : Color from Quantity )
|
||||
returns ColorMapEntry from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the nearest ColorMapEntry that match aColor .
|
||||
---C++: return const &
|
||||
|
||||
AddEntry (me : mutable; aColor : Color from Quantity)
|
||||
returns Integer from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Search an identical color entry in the color map <me>
|
||||
-- or returns the nearest ColorMapEntry Index.
|
||||
|
||||
fields
|
||||
mybasepixel : Integer from Standard ;
|
||||
mygreenmax , mygreenmult : Integer from Standard ;
|
||||
myredmax , myredmult : Integer from Standard ;
|
||||
mybluemax , mybluemult : Integer from Standard ;
|
||||
-- ColorCube definition for a ColorCube ColorMap.
|
||||
|
||||
end ColorCubeColorMap ;
|
144
src/Aspect/Aspect_ColorCubeColorMap.cxx
Executable file
144
src/Aspect/Aspect_ColorCubeColorMap.cxx
Executable file
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// Modified : GG ; 14/09/01 Implements the new AddEntry method
|
||||
//
|
||||
|
||||
#include <Aspect_ColorCubeColorMap.ixx>
|
||||
#include <Aspect_ColorMapEntry.hxx>
|
||||
|
||||
#ifdef TRACE
|
||||
static int Tlevel = 0 ;
|
||||
#endif
|
||||
|
||||
Aspect_ColorCubeColorMap::Aspect_ColorCubeColorMap(
|
||||
const Standard_Integer basepixel ,
|
||||
const Standard_Integer red_max ,
|
||||
const Standard_Integer red_mult ,
|
||||
const Standard_Integer green_max ,
|
||||
const Standard_Integer green_mult ,
|
||||
const Standard_Integer blue_max ,
|
||||
const Standard_Integer blue_mult )
|
||||
:Aspect_ColorMap( Aspect_TOC_ColorCube )
|
||||
|
||||
{ Standard_Integer r,g,b,i ;
|
||||
Aspect_ColorMapEntry value ;
|
||||
Quantity_Color rgb ;
|
||||
Standard_Integer max[3], mult[3], ti[3];
|
||||
|
||||
mybasepixel = basepixel ;
|
||||
myredmax = red_max ;
|
||||
myredmult = red_mult ;
|
||||
mygreenmax = green_max ;
|
||||
mygreenmult = green_mult ;
|
||||
mybluemax = blue_max ;
|
||||
mybluemult = blue_mult ;
|
||||
|
||||
r = 0 ; g = 1 ; b = 2 ;
|
||||
|
||||
if ( ( myredmult < mygreenmult ) && ( myredmult < mybluemult ) ) {
|
||||
r = 0 ;
|
||||
if ( mygreenmult < mybluemult ) { g = 1 ; b = 2 ; }
|
||||
else { b = 1 ; g = 2 ; }
|
||||
}
|
||||
if ( ( mygreenmult < myredmult ) && ( mygreenmult < mybluemult ) ) {
|
||||
g = 0 ;
|
||||
if ( myredmult < mybluemult ) { r = 1 ; b = 2 ; }
|
||||
else { b = 1 ; r = 2 ; }
|
||||
}
|
||||
if ( ( mybluemult < myredmult ) && ( mybluemult < mygreenmult ) ) {
|
||||
b = 0 ;
|
||||
if ( myredmult < mygreenmult ) { r = 1 ; g = 2 ; }
|
||||
else { g = 1 ; r = 2 ; }
|
||||
}
|
||||
|
||||
#ifdef TRACE
|
||||
if ( Tlevel )
|
||||
cout << "ColorCubeColorMap constructor (r,g,b) :"
|
||||
<< r << "," << g << "," << b << endl << flush ;
|
||||
#endif
|
||||
|
||||
mult[r] = myredmult ; max[r] = myredmax ;
|
||||
mult[g] = mygreenmult ; max[g] = mygreenmax ;
|
||||
mult[b] = mybluemult ; max[b] = mybluemax ;
|
||||
|
||||
for( ti[2] = 0 ; ti[2] <= max[2] ; ti[2]++ ) {
|
||||
for( ti[1] = 0 ; ti[1] <= max[1] ; ti[1]++ ) {
|
||||
for( ti[0] = 0 ; ti[0] <= max[0] ; ti[0]++ ) {
|
||||
rgb.SetValues( (Standard_Real) ti[r] / (Standard_Real) max[r],
|
||||
(Standard_Real) ti[g] / (Standard_Real) max[g],
|
||||
(Standard_Real) ti[b] / (Standard_Real) max[b],
|
||||
Quantity_TOC_RGB ) ;
|
||||
|
||||
i = ti[r] * mult[r] + ti[g] * mult[g] + ti[b] * mult[b] ;
|
||||
|
||||
value.SetValue( mybasepixel+i, rgb ) ;
|
||||
#ifdef TRACE
|
||||
if ( Tlevel )
|
||||
value.Dump() ;
|
||||
#endif
|
||||
mydata.Append( value ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const Aspect_ColorMapEntry& Aspect_ColorCubeColorMap::NearestEntry(
|
||||
const Quantity_Color& color ) const
|
||||
|
||||
{
|
||||
return( Entry( NearestColorMapIndex( color ) ) ) ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorCubeColorMap::NearestColorMapIndex(
|
||||
const Quantity_Color& color ) const
|
||||
|
||||
{ Standard_Integer r,g,b ;
|
||||
|
||||
r = (Standard_Integer ) ( color.Red() * myredmax + 0.5) ;
|
||||
g = (Standard_Integer ) ( color.Green() * mygreenmax + 0.5) ;
|
||||
b = (Standard_Integer ) ( color.Blue() * mybluemax + 0.5) ;
|
||||
|
||||
return( r*myredmult+g*mygreenmult+b*mybluemult + 1 ) ;
|
||||
}
|
||||
|
||||
const Aspect_ColorMapEntry& Aspect_ColorCubeColorMap::FindEntry(
|
||||
const Standard_Integer index ) const
|
||||
|
||||
{
|
||||
return( Entry( FindColorMapIndex( index ) ) ) ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorCubeColorMap::FindColorMapIndex(
|
||||
const Standard_Integer index ) const
|
||||
{
|
||||
|
||||
if ( index < mybasepixel ||
|
||||
index >= ( mybasepixel+Size() ) ){
|
||||
Aspect_BadAccess::Raise ("FindEntryIndex() index not found.");
|
||||
}
|
||||
|
||||
return( index - mybasepixel + 1 ) ;
|
||||
}
|
||||
|
||||
void Aspect_ColorCubeColorMap::ColorCubeDefinition(
|
||||
Standard_Integer& basepixel ,
|
||||
Standard_Integer& red_max ,
|
||||
Standard_Integer& red_mult ,
|
||||
Standard_Integer& green_max ,
|
||||
Standard_Integer& green_mult ,
|
||||
Standard_Integer& blue_max ,
|
||||
Standard_Integer& blue_mult ) const
|
||||
|
||||
{
|
||||
basepixel = mybasepixel ;
|
||||
red_max = myredmax ;
|
||||
red_mult = myredmult ;
|
||||
green_max = mygreenmax ;
|
||||
green_mult = mygreenmult ;
|
||||
blue_max = mybluemax ;
|
||||
blue_mult = mybluemult ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorCubeColorMap::AddEntry (const Quantity_Color &aColor) {
|
||||
|
||||
return mybasepixel + NearestColorMapIndex(aColor) - 1;
|
||||
}
|
103
src/Aspect/Aspect_ColorMap.cdl
Executable file
103
src/Aspect/Aspect_ColorMap.cdl
Executable file
@@ -0,0 +1,103 @@
|
||||
--
|
||||
-- File: Aspect_ColorMap.cdl
|
||||
-- Created: 23/03/93
|
||||
-- Author: BBL
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
deferred class ColorMap from Aspect inherits TShared from MMgt
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a ColorMap object.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
uses
|
||||
Color from Quantity,
|
||||
TypeOfColorMap from Aspect,
|
||||
ColorMapEntry from Aspect,
|
||||
SequenceOfColorMapEntry from Aspect
|
||||
|
||||
raises
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
|
||||
Initialize( type : TypeOfColorMap from Aspect );
|
||||
|
||||
Type( me )
|
||||
returns TypeOfColorMap from Aspect is static;
|
||||
---Level: Public
|
||||
|
||||
Size( me ) returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Allocated colormap Size
|
||||
|
||||
Index( me ; aColormapIndex : Integer ) returns Integer from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the ColorMapEntry.Index of the ColorMap
|
||||
-- at rank <aColormapIndex> .
|
||||
raises BadAccess from Aspect is static;
|
||||
---Trigger: Raises BadAccess if the index less than 1 or
|
||||
-- greater than Size.
|
||||
|
||||
Dump( me ) ;
|
||||
---Level: Internal
|
||||
|
||||
Entry ( me ; AColorMapIndex : Integer from Standard )
|
||||
returns ColorMapEntry from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Return the value of the <Index>th element of
|
||||
-- the ColorMap
|
||||
raises BadAccess from Aspect is static;
|
||||
---Trigger: Raises BadAccess if the index less than 1 or
|
||||
-- greater than Size.
|
||||
---C++: return const &
|
||||
|
||||
FindColorMapIndex ( me ;
|
||||
AColorMapEntryIndex : Integer from Standard )
|
||||
returns Integer from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the index in the ColorMap of the
|
||||
-- ColorMapEntry.Index() equal to <AnEntryIndex>.
|
||||
raises BadAccess from Aspect is deferred ;
|
||||
---Trigger: Raises BadAccess if the index is not defined in the
|
||||
-- ColorMap.
|
||||
|
||||
FindEntry ( me ; AColorMapEntryIndex : Integer from Standard )
|
||||
returns ColorMapEntry from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Returns the ColorMapEntry with ColorMapEntry.Index()
|
||||
-- equal to <AnEntryIndex>.
|
||||
raises BadAccess from Aspect is deferred ;
|
||||
---Trigger: Raises BadAccess if the index is not defined in the
|
||||
-- ColorMap.
|
||||
---C++: return const &
|
||||
|
||||
NearestColorMapIndex( me ; aColor : Color from Quantity )
|
||||
returns Integer from Standard is deferred ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the index in the ColorMap of the
|
||||
-- nearest matching ColorMapEntry
|
||||
|
||||
NearestEntry( me ; aColor : Color from Quantity )
|
||||
returns ColorMapEntry from Aspect is deferred ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the nearest ColorMapEntry that match aColor .
|
||||
---C++: return const &
|
||||
|
||||
AddEntry (me : mutable; aColor : Color from Quantity)
|
||||
returns Integer from Standard is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Search an identical color entry in the color map <me>
|
||||
-- and returns the ColorMapEntry Index if exist.
|
||||
-- Or add a new entry and returns the computed ColorMapEntry index used.
|
||||
|
||||
fields
|
||||
|
||||
mytype : TypeOfColorMap from Aspect;
|
||||
mydata : SequenceOfColorMapEntry from Aspect is protected;
|
||||
|
||||
end ColorMap ;
|
44
src/Aspect/Aspect_ColorMap.cxx
Executable file
44
src/Aspect/Aspect_ColorMap.cxx
Executable file
@@ -0,0 +1,44 @@
|
||||
|
||||
#include <Aspect_ColorMap.ixx>
|
||||
|
||||
Aspect_ColorMap::Aspect_ColorMap( const Aspect_TypeOfColorMap type ) {
|
||||
|
||||
mytype = type;
|
||||
}
|
||||
|
||||
Aspect_TypeOfColorMap Aspect_ColorMap::Type() const {
|
||||
|
||||
return mytype ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorMap::Size() const {
|
||||
|
||||
return mydata.Length() ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorMap::Index(const Standard_Integer anIndex) const {
|
||||
|
||||
if( anIndex < 1 || anIndex > Size() ) {
|
||||
Aspect_BadAccess::Raise ("Undefined colormap Index");
|
||||
}
|
||||
|
||||
Aspect_ColorMapEntry theEntry = mydata.Value(anIndex) ;
|
||||
|
||||
return theEntry.Index() ;
|
||||
}
|
||||
|
||||
const Aspect_ColorMapEntry& Aspect_ColorMap::Entry (const Standard_Integer AnIndex) const {
|
||||
|
||||
return mydata.Value(AnIndex);
|
||||
}
|
||||
|
||||
void Aspect_ColorMap::Dump () const {
|
||||
|
||||
Standard_Integer i ;
|
||||
|
||||
cout << "Colormap Dump-->\n" ;
|
||||
|
||||
for ( i = 1 ; i <= Size() ; i++ ) (Entry(i)).Dump() ;
|
||||
|
||||
cout << "<--End Colormap Dump\n" ;
|
||||
}
|
96
src/Aspect/Aspect_ColorMapEntry.cdl
Executable file
96
src/Aspect/Aspect_ColorMapEntry.cdl
Executable file
@@ -0,0 +1,96 @@
|
||||
|
||||
--
|
||||
-- File: Aspect_ColorMapEntries.cdl
|
||||
-- Created: 23/03/93
|
||||
-- Author: BBL
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
class ColorMapEntry from Aspect inherits Storable from Standard
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a colormap entry.
|
||||
-- A colormap entry is an association between
|
||||
-- a RGB object and a index in the colormap.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
Color from Quantity
|
||||
|
||||
raises
|
||||
OutOfRange from Standard,
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
Create
|
||||
returns ColorMapEntry from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates an unallocated colormap entry
|
||||
|
||||
Create ( index : in Integer from Standard;
|
||||
rgb : in Color from Quantity)
|
||||
returns ColorMapEntry;
|
||||
---Level: Public
|
||||
---Purpose: Creates an allocated colormap entry
|
||||
|
||||
Create ( entry : in ColorMapEntry from Aspect )
|
||||
returns ColorMapEntry
|
||||
---Level: Public
|
||||
---Purpose: Creates an allocated colormap entry.
|
||||
-- Warning: Raises error if the colormap entry <entry>
|
||||
-- is unallocated.
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
SetValue ( me: in out; index : in Integer from Standard;
|
||||
rgb : in Color from Quantity );
|
||||
---Level: Public
|
||||
---Purpose: Sets colormap entry value and allocates it.
|
||||
|
||||
SetValue ( me: in out; entry : in ColorMapEntry from Aspect);
|
||||
---Level: Public
|
||||
---Purpose: Sets colormap entry value and allocates it.
|
||||
---C++: alias operator =
|
||||
|
||||
SetColor ( me: in out; rgb : in Color from Quantity );
|
||||
---Level: Public
|
||||
---Purpose: Sets color <rgb> of colormap entry.
|
||||
|
||||
Color ( me : in ) returns Color from Quantity
|
||||
---Warning: Raises error if the colormap entry is unallocated .
|
||||
raises BadAccess from Aspect;
|
||||
---C++: return const &
|
||||
|
||||
SetIndex ( me: in out; index : in Integer from Standard);
|
||||
---Level: Public
|
||||
---Purpose: Sets index value of a colormap entry.
|
||||
|
||||
Index ( me : in ) returns Integer from Standard
|
||||
---Warning: Raises error if the colormap entry is unallocated .
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
Free ( me : in out );
|
||||
---Level: Public
|
||||
---Purpose: Unallocates the colormap entry.
|
||||
|
||||
IsAllocated ( me : in )
|
||||
returns Boolean from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns True if the colormap entry is allocated.
|
||||
-- Warning: A colormap entry is allocated when the color and
|
||||
-- the index is defined.
|
||||
|
||||
Dump( me : in ) ;
|
||||
---Level: Internal
|
||||
|
||||
fields
|
||||
allocated : Boolean from Standard;
|
||||
mycolor : Color from Quantity;
|
||||
myindex : Integer from Standard;
|
||||
myColorIsDef : Boolean from Standard;
|
||||
myIndexIsDef : Boolean from Standard;
|
||||
|
||||
end ColorMapEntry from Aspect;
|
127
src/Aspect/Aspect_ColorMapEntry.cxx
Executable file
127
src/Aspect/Aspect_ColorMapEntry.cxx
Executable file
@@ -0,0 +1,127 @@
|
||||
#include <Aspect_ColorMapEntry.ixx>
|
||||
|
||||
Aspect_ColorMapEntry::Aspect_ColorMapEntry() {
|
||||
|
||||
myColorIsDef = Standard_True;
|
||||
myIndexIsDef = Standard_True;
|
||||
allocated = myColorIsDef && myIndexIsDef;
|
||||
myindex = 0;
|
||||
mycolor.SetValues (0., 0., 0., Quantity_TOC_RGB);
|
||||
|
||||
}
|
||||
|
||||
Aspect_ColorMapEntry::Aspect_ColorMapEntry (const Standard_Integer index, const Quantity_Color &color) {
|
||||
|
||||
myColorIsDef = Standard_True;
|
||||
myIndexIsDef = Standard_True;
|
||||
allocated = myColorIsDef && myIndexIsDef;
|
||||
myindex = index;
|
||||
mycolor = color;
|
||||
|
||||
}
|
||||
|
||||
Aspect_ColorMapEntry::Aspect_ColorMapEntry (const Aspect_ColorMapEntry& entry) {
|
||||
|
||||
if (entry.allocated == Standard_False) {
|
||||
Aspect_BadAccess::Raise
|
||||
("Aspect_ColorMapEntry::Aspect_ColorMapEntry Unallocated ColorMapEntry");
|
||||
}
|
||||
else {
|
||||
myColorIsDef = Standard_True;
|
||||
myIndexIsDef = Standard_True;
|
||||
allocated = myColorIsDef && myIndexIsDef;
|
||||
myindex = entry.myindex;
|
||||
mycolor = entry.mycolor;
|
||||
}
|
||||
}
|
||||
|
||||
void Aspect_ColorMapEntry::SetValue (const Standard_Integer index, const Quantity_Color &color) {
|
||||
|
||||
myColorIsDef = Standard_True;
|
||||
myIndexIsDef = Standard_True;
|
||||
allocated = myColorIsDef && myIndexIsDef;
|
||||
myindex = index;
|
||||
mycolor = color;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_ColorMapEntry::SetValue (const Aspect_ColorMapEntry& entry) {
|
||||
|
||||
if (entry.allocated == Standard_False) {
|
||||
Aspect_BadAccess::Raise
|
||||
("Aspect_ColorMapEntry::Aspect_ColorMapEntry Unallocated ColorMapEntry");
|
||||
}
|
||||
else {
|
||||
myColorIsDef = Standard_True;
|
||||
myIndexIsDef = Standard_True;
|
||||
allocated = myColorIsDef && myIndexIsDef;
|
||||
myindex = entry.myindex;
|
||||
mycolor = entry.mycolor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Aspect_ColorMapEntry::SetColor (const Quantity_Color &color) {
|
||||
|
||||
myColorIsDef = Standard_True;
|
||||
allocated = myColorIsDef && myIndexIsDef;
|
||||
mycolor = color;
|
||||
|
||||
}
|
||||
|
||||
const Quantity_Color& Aspect_ColorMapEntry::Color () const {
|
||||
|
||||
if (allocated == Standard_False)
|
||||
Aspect_BadAccess::Raise
|
||||
("Aspect_ColorMapEntry::Color Unallocated ColorMapEntry");
|
||||
|
||||
return mycolor;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_ColorMapEntry::SetIndex (const Standard_Integer index) {
|
||||
|
||||
myColorIsDef = Standard_True;
|
||||
allocated = myColorIsDef && myIndexIsDef;
|
||||
myindex = index;
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorMapEntry::Index () const {
|
||||
|
||||
if (allocated == Standard_False)
|
||||
Aspect_BadAccess::Raise
|
||||
("Aspect_ColorMapEntry::Index Unallocated ColorMapEntry");
|
||||
|
||||
return myindex;
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_ColorMapEntry::IsAllocated () const {
|
||||
|
||||
return allocated;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_ColorMapEntry::Free () {
|
||||
|
||||
myColorIsDef = Standard_False;
|
||||
myIndexIsDef = Standard_False;
|
||||
allocated = myColorIsDef && myIndexIsDef;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_ColorMapEntry::Dump () const {
|
||||
|
||||
Standard_Real r,g,b ;
|
||||
|
||||
mycolor.Values( r,g,b, Quantity_TOC_RGB ) ;
|
||||
|
||||
cout << flush;
|
||||
cout << "myColorIsDef : " << (myColorIsDef ? "True " : "False") << " , "
|
||||
<< "myIndexIsDef : " << (myIndexIsDef ? "True " : "False") << " , "
|
||||
<< "allocated : " << (allocated ? "True " : "False") << "\n";
|
||||
cout << "myindex : " << myindex << " myColor : ( "
|
||||
<< r << ", " << g << ", " << g << " )\n";
|
||||
cout << flush;
|
||||
}
|
48
src/Aspect/Aspect_ColorPixel.cdl
Executable file
48
src/Aspect/Aspect_ColorPixel.cdl
Executable file
@@ -0,0 +1,48 @@
|
||||
|
||||
-- File: Aspect_ColorPixel.cdl
|
||||
-- Created: Fri Jul 23 16:25:00 1993
|
||||
-- Author: Jean Louis FRENKEL
|
||||
-- <jlf@sparc3>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
class ColorPixel from Aspect inherits Pixel from Aspect
|
||||
|
||||
uses
|
||||
Color from Quantity
|
||||
is
|
||||
|
||||
Create returns ColorPixel from Aspect;
|
||||
---Level: Public
|
||||
|
||||
Create(aColor: Color from Quantity) returns ColorPixel from Aspect;
|
||||
---Level: Public
|
||||
|
||||
Value (me) returns Color from Quantity is static ;
|
||||
---Level: Public
|
||||
---C++: return const &
|
||||
|
||||
SetValue(me: in out; aColor: Color from Quantity) is static ;
|
||||
---Level: Public
|
||||
|
||||
Print( me ; s : in out OStream from Standard ) is redefined static ;
|
||||
---Level: Public
|
||||
---Purpose : Prints the contents of <me> on the stream <s>
|
||||
|
||||
HashCode (me; Upper : Integer ) returns Integer is redefined static ;
|
||||
---Level: Public
|
||||
---Purpose: Returns a hashed value denoting <me>. This value is in
|
||||
-- the range 1..<Upper>.
|
||||
---C++: function call
|
||||
|
||||
IsEqual(me; Other : ColorPixel from Aspect) returns Boolean;
|
||||
---C++: alias operator==
|
||||
|
||||
IsNotEqual(me; Other : ColorPixel from Aspect) returns Boolean;
|
||||
---C++: alias operator!=
|
||||
|
||||
|
||||
|
||||
fields
|
||||
myColor: Color from Quantity;
|
||||
|
||||
end ColorPixel from Aspect;
|
60
src/Aspect/Aspect_ColorPixel.cxx
Executable file
60
src/Aspect/Aspect_ColorPixel.cxx
Executable file
@@ -0,0 +1,60 @@
|
||||
#include <Aspect_ColorPixel.ixx>
|
||||
|
||||
Aspect_ColorPixel::Aspect_ColorPixel () {
|
||||
|
||||
myColor.SetValues( 0.,0.,0. , Quantity_TOC_RGB ) ;
|
||||
|
||||
}
|
||||
|
||||
Aspect_ColorPixel::Aspect_ColorPixel (const Quantity_Color& aColor) {
|
||||
|
||||
myColor = aColor;
|
||||
|
||||
}
|
||||
|
||||
const Quantity_Color& Aspect_ColorPixel::Value() const {
|
||||
|
||||
return myColor;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Aspect_ColorPixel::SetValue(const Quantity_Color& aColor) {
|
||||
|
||||
myColor = aColor;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_ColorPixel::Print(Standard_OStream& s) const
|
||||
|
||||
{ Standard_Real r,g,b ;
|
||||
|
||||
myColor.Values( r,g,b, Quantity_TOC_RGB ) ;
|
||||
|
||||
s << "( " << r << ", " << g << ", " << b << " )" << flush;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Hascode : Computes a hascoding value for a given Aspect_ColorPixel
|
||||
// ------------------------------------------------------------------
|
||||
Standard_Integer Aspect_ColorPixel::HashCode(const Standard_Integer Upper) const
|
||||
{ Standard_Real r,g,b ;
|
||||
Standard_Integer ret ;
|
||||
|
||||
myColor.Values( r,g,b, Quantity_TOC_RGB ) ;
|
||||
|
||||
ret = ( Standard_Integer ) ( ( r + g + b ) * Upper ) ;
|
||||
|
||||
return ( ret % Upper ) + 1 ;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean Aspect_ColorPixel::IsEqual(const Aspect_ColorPixel& Other) const
|
||||
{
|
||||
return (myColor == Other.myColor);
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_ColorPixel::IsNotEqual(const Aspect_ColorPixel& Other) const
|
||||
{
|
||||
return !IsEqual(Other);
|
||||
}
|
101
src/Aspect/Aspect_ColorRampColorMap.cdl
Executable file
101
src/Aspect/Aspect_ColorRampColorMap.cdl
Executable file
@@ -0,0 +1,101 @@
|
||||
--
|
||||
-- File: Aspect_ColorRampColorMap.cdl
|
||||
-- Created: 23/03/93
|
||||
-- Author: BBL
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
class ColorRampColorMap from Aspect inherits ColorMap from Aspect
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a ColorRampColorMap object.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
Color from Quantity,
|
||||
NameOfColor from Quantity,
|
||||
ColorMapEntry from Aspect
|
||||
|
||||
raises
|
||||
RangeError from Standard,
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
Create( basepixel,dimension : in Integer from Standard ;
|
||||
color : in Color from Quantity )
|
||||
returns mutable ColorRampColorMap from Aspect
|
||||
raises RangeError from Standard ;
|
||||
---Level: Public
|
||||
---Purpose : Create a Color Ramp Colormap starting from Black at
|
||||
-- basepixel to color at basepixel+dimension-1.
|
||||
|
||||
Create( basepixel,dimension : in Integer from Standard ;
|
||||
colorName : in NameOfColor from Quantity )
|
||||
returns mutable ColorRampColorMap from Aspect
|
||||
raises RangeError from Standard ;
|
||||
---Level: Public
|
||||
---Purpose : Create a Color Ramp Colormap starting from Black at
|
||||
-- basepixel to color at basepixel+dimension-1.
|
||||
|
||||
ColorRampDefinition( me : in ;
|
||||
basepixel,dimension : out Integer from Standard ;
|
||||
color : out Color from Quantity ) ;
|
||||
---Level: Public
|
||||
---Purpose : Get Color Ramp Colormap definition .
|
||||
|
||||
ComputeEntry( me : in out mutable ;
|
||||
basepixel,dimension : in Integer from Standard ;
|
||||
color : in Color from Quantity )
|
||||
raises RangeError from Standard is private ;
|
||||
---Level: Public
|
||||
---Purpose : Create a Color Ramp Colormap starting from Black at
|
||||
-- basepixel to color at basepixel+dimension-1.
|
||||
|
||||
FindColorMapIndex ( me ;
|
||||
ColorMapEntryIndex : Integer from Standard )
|
||||
returns Integer from Standard
|
||||
raises BadAccess from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the index in the ColorMap of the
|
||||
-- ColorMapEntry.Index() equal to <AnEntryIndex>.
|
||||
-- Warning: Raises BadAccess if the index is not defined in the
|
||||
-- ColorMap.
|
||||
|
||||
FindEntry ( me ; AColorMapEntryIndex : Integer from Standard )
|
||||
returns ColorMapEntry from Aspect
|
||||
raises BadAccess from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the ColorMapEntry with ColorMapEntry.Index()
|
||||
-- equal to <AnEntryIndex>.
|
||||
-- Warning: Raises BadAccess if the index is not defined in the
|
||||
-- ColorMap.
|
||||
---C++: return const &
|
||||
|
||||
NearestColorMapIndex( me ; aColor : Color from Quantity )
|
||||
returns Integer from Standard ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the index in the ColorMap of the
|
||||
-- nearest matching ColorMapEntry
|
||||
|
||||
NearestEntry( me ; aColor : Color from Quantity )
|
||||
returns ColorMapEntry from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the nearest ColorMapEntry that match aColor .
|
||||
---C++: return const &
|
||||
|
||||
AddEntry (me : mutable; aColor : Color from Quantity)
|
||||
returns Integer from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Search an identical color entry in the color map <me>
|
||||
-- or returns the nearest ColorMapEntry Index.
|
||||
|
||||
fields
|
||||
mycolor : Color from Quantity ;
|
||||
mybasepixel : Integer from Standard ;
|
||||
mydimension : Integer from Standard ;
|
||||
|
||||
end ColorRampColorMap ;
|
114
src/Aspect/Aspect_ColorRampColorMap.cxx
Executable file
114
src/Aspect/Aspect_ColorRampColorMap.cxx
Executable file
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// Modified : GG ; 14/09/01 Implements the new AddEntry method
|
||||
//
|
||||
|
||||
#define IMP140901 // GG Compute correctly the color ramp
|
||||
// accordingly to the requested color.
|
||||
|
||||
#include <Aspect_ColorRampColorMap.ixx>
|
||||
#include <Aspect_ColorMapEntry.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
|
||||
|
||||
Aspect_ColorRampColorMap::Aspect_ColorRampColorMap(
|
||||
const Standard_Integer basepixel ,
|
||||
const Standard_Integer dimension ,
|
||||
const Quantity_NameOfColor color )
|
||||
:Aspect_ColorMap(Aspect_TOC_ColorRamp )
|
||||
|
||||
{ ComputeEntry( basepixel, dimension,
|
||||
Quantity_Color( color ) ) ; }
|
||||
|
||||
Aspect_ColorRampColorMap::Aspect_ColorRampColorMap(
|
||||
const Standard_Integer basepixel ,
|
||||
const Standard_Integer dimension ,
|
||||
const Quantity_Color& color )
|
||||
:Aspect_ColorMap(Aspect_TOC_ColorRamp )
|
||||
|
||||
{ ComputeEntry( basepixel, dimension, color ) ; }
|
||||
|
||||
void Aspect_ColorRampColorMap::ComputeEntry(
|
||||
const Standard_Integer basepixel ,
|
||||
const Standard_Integer dimension ,
|
||||
const Quantity_Color& color )
|
||||
|
||||
{ Standard_Integer i ;
|
||||
Aspect_ColorMapEntry value ;
|
||||
Quantity_Color rgb ;
|
||||
Standard_Real v ;
|
||||
#ifdef IMP140901
|
||||
Standard_Real r,g,b;
|
||||
#endif
|
||||
|
||||
mycolor = color ;
|
||||
mybasepixel = basepixel ;
|
||||
mydimension = dimension ;
|
||||
#ifdef IMP140901
|
||||
mycolor.Values(r,g,b,Quantity_TOC_RGB);
|
||||
#endif
|
||||
|
||||
for( i = 0 ; i < dimension ; i++ ) {
|
||||
v = ( Standard_Real ) i /
|
||||
( Standard_Real )(dimension-1) ;
|
||||
|
||||
#ifdef IMP140901
|
||||
rgb.SetValues( r*v, g*v, b*v, Quantity_TOC_RGB ) ;
|
||||
#else
|
||||
rgb.SetValues( v, v, v, Quantity_TOC_RGB ) ;
|
||||
#endif
|
||||
|
||||
value.SetValue( basepixel+i, rgb ) ;
|
||||
|
||||
mydata.Append( value ) ;
|
||||
}
|
||||
}
|
||||
|
||||
const Aspect_ColorMapEntry& Aspect_ColorRampColorMap::NearestEntry(
|
||||
const Quantity_Color& color ) const
|
||||
|
||||
{
|
||||
return( Entry( NearestColorMapIndex( color ) ) ) ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorRampColorMap::NearestColorMapIndex(
|
||||
const Quantity_Color& color ) const
|
||||
|
||||
{
|
||||
return( (Standard_Integer ) ( ( color.Light() * (mydimension-1) ) + 1 )) ;
|
||||
}
|
||||
|
||||
|
||||
const Aspect_ColorMapEntry& Aspect_ColorRampColorMap::FindEntry(
|
||||
const Standard_Integer index ) const
|
||||
|
||||
{
|
||||
return( Entry( FindColorMapIndex( index ) ) ) ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorRampColorMap::FindColorMapIndex(
|
||||
const Standard_Integer index ) const
|
||||
{
|
||||
|
||||
if ( index < mybasepixel ||
|
||||
index >= ( mybasepixel+mydimension ) ){
|
||||
Aspect_BadAccess::Raise ("FindEntryIndex() index not found.");
|
||||
}
|
||||
|
||||
return( index - mybasepixel + 1 ) ;
|
||||
}
|
||||
|
||||
void Aspect_ColorRampColorMap::ColorRampDefinition(
|
||||
Standard_Integer& basepixel,
|
||||
Standard_Integer& size,
|
||||
Quantity_Color& color ) const
|
||||
|
||||
{ basepixel = mybasepixel ;
|
||||
size = mydimension ;
|
||||
color = mycolor ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorRampColorMap::AddEntry (const Quantity_Color &aColor) {
|
||||
|
||||
return mybasepixel + NearestColorMapIndex(aColor) - 1;
|
||||
}
|
||||
|
308
src/Aspect/Aspect_ColorScale.cdl
Executable file
308
src/Aspect/Aspect_ColorScale.cdl
Executable file
@@ -0,0 +1,308 @@
|
||||
-- File: Aspect_ColorScale.cdl
|
||||
-- Created: 22/06/2004
|
||||
-- Author: STV
|
||||
--
|
||||
---Copyright: Open Cascade 2004
|
||||
--
|
||||
|
||||
deferred class ColorScale from Aspect inherits TShared from MMgt
|
||||
|
||||
uses
|
||||
|
||||
TypeOfColorScaleData from Aspect,
|
||||
TypeOfColorScalePosition from Aspect,
|
||||
ColorMap from Aspect,
|
||||
SequenceOfColor from Aspect,
|
||||
View from Viewer,
|
||||
Color from Quantity,
|
||||
AsciiString from TCollection,
|
||||
ExtendedString from TCollection,
|
||||
SequenceOfExtendedString from TColStd
|
||||
|
||||
is
|
||||
|
||||
---Category: Public
|
||||
|
||||
FindColor( me; Value : Real from Standard;
|
||||
Color : in out Color from Quantity ) returns Boolean from Standard;
|
||||
---Purpose: Calculate color according passed value; returns true if value is in range or false, if isn't
|
||||
|
||||
|
||||
FindColor( myclass; Value : Real from Standard;
|
||||
Min, Max : Real from Standard;
|
||||
ColorsCount : Integer from Standard;
|
||||
Color : in out Color from Quantity ) returns Boolean from Standard;
|
||||
|
||||
GetMin(me)
|
||||
returns Real from Standard;
|
||||
---Purpose: Returns minimal value of color scale;
|
||||
|
||||
GetMax(me)
|
||||
returns Real from Standard;
|
||||
---Purpose: Returns maximal value of color scale;
|
||||
|
||||
GetRange(me; aMin : in out Real from Standard;
|
||||
aMax : in out Real from Standard);
|
||||
---Purpose: Returns minimal and maximal values of color scale;
|
||||
|
||||
GetLabelType(me)
|
||||
returns TypeOfColorScaleData from Aspect;
|
||||
---Purpose: Returns the type of labels;
|
||||
--- Aspect_TOCSD_AUTO - labels as boundary values for intervals
|
||||
--- Aspect_TOCSD_USER - user specified label is used
|
||||
|
||||
GetColorType(me)
|
||||
returns TypeOfColorScaleData from Aspect;
|
||||
---Purpose: Returns the type of colors;
|
||||
--- Aspect_TOCSD_AUTO - value between Red and Blue
|
||||
--- Aspect_TOCSD_USER - user specified color from color map
|
||||
|
||||
GetNumberOfIntervals(me)
|
||||
returns Integer from Standard;
|
||||
---Purpose: Returns the number of color scale intervals;
|
||||
|
||||
GetTitle(me)
|
||||
returns ExtendedString from TCollection;
|
||||
---Purpose: Returns the color scale title string;
|
||||
|
||||
GetFormat(me)
|
||||
returns AsciiString from TCollection;
|
||||
---Purpose: Returns the format for numbers.
|
||||
-- The same like format for function printf().
|
||||
-- Used if GetLabelType() is TOCSD_AUTO;
|
||||
|
||||
GetLabel(me; anIndex : Integer from Standard)
|
||||
returns ExtendedString from TCollection;
|
||||
---Purpose: Returns the user specified label with index <anIndex>.
|
||||
-- Returns empty string if label not defined.
|
||||
|
||||
GetColor(me; anIndex : Integer from Standard)
|
||||
returns Color from Quantity;
|
||||
---Purpose: Returns the user specified color from color map with index <anIndex>.
|
||||
-- Returns default color if index out of range in color map.
|
||||
|
||||
GetLabels(me; aLabels : in out SequenceOfExtendedString from TColStd);
|
||||
---Purpose: Returns the user specified labels.
|
||||
|
||||
GetColors(me; aColors : in out SequenceOfColor from Aspect);
|
||||
---Purpose: Returns the user specified colors.
|
||||
|
||||
GetLabelPosition(me)
|
||||
returns TypeOfColorScalePosition from Aspect;
|
||||
---Purpose: Returns the position of labels concerning color filled rectangles.
|
||||
|
||||
GetTitlePosition(me)
|
||||
returns TypeOfColorScalePosition from Aspect;
|
||||
---Purpose: Returns the position of color scale title.
|
||||
|
||||
IsReversed(me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Returns true if the labels and colors used in reversed order.
|
||||
|
||||
IsLabelAtBorder(me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Returns true if the labels placed at border of color filled rectangles.
|
||||
|
||||
SetMin(me : mutable; aMin : Real from Standard);
|
||||
---Purpose: Sets the minimal value of color scale.
|
||||
|
||||
SetMax(me : mutable; aMax : Real from Standard);
|
||||
---Purpose: Sets the maximal value of color scale.
|
||||
|
||||
SetRange(me : mutable; aMin : Real from Standard;
|
||||
aMax : Real from Standard);
|
||||
---Purpose: Sets the minimal and maximal value of color scale.
|
||||
|
||||
SetLabelType(me : mutable; aType : TypeOfColorScaleData from Aspect);
|
||||
---Purpose: Sets the type of labels.
|
||||
-- Aspect_TOCSD_AUTO - labels as boundary values for intervals
|
||||
-- Aspect_TOCSD_USER - user specified label is used
|
||||
|
||||
SetColorType(me : mutable; aType : TypeOfColorScaleData from Aspect);
|
||||
---Purpose: Sets the type of colors.
|
||||
-- Aspect_TOCSD_AUTO - value between Red and Blue
|
||||
-- Aspect_TOCSD_USER - user specified color from color map
|
||||
|
||||
SetNumberOfIntervals(me : mutable; aNum : Integer from Standard);
|
||||
---Purpose: Sets the number of color scale intervals.
|
||||
|
||||
SetTitle(me : mutable; aTitle : ExtendedString from TCollection);
|
||||
---Purpose: Sets the color scale title string.
|
||||
|
||||
SetFormat(me : mutable; aFormat : AsciiString from TCollection);
|
||||
---Purpose: Sets the color scale auto label format specification.
|
||||
|
||||
SetLabel(me : mutable; aLabel : ExtendedString from TCollection;
|
||||
anIndex : Integer from Standard = -1);
|
||||
---Purpose: Sets the color scale label at index. Index started from 1.
|
||||
|
||||
SetColor(me : mutable; aColor : Color from Quantity;
|
||||
anIndex : Integer from Standard = -1);
|
||||
---Purpose: Sets the color scale color at index. Index started from 1.
|
||||
|
||||
SetLabels(me : mutable; aSeq : SequenceOfExtendedString from TColStd);
|
||||
---Purpose: Sets the color scale labels.
|
||||
|
||||
SetColors(me : mutable; aMap : ColorMap from Aspect);
|
||||
---Purpose: Sets the color scale colors.
|
||||
|
||||
SetColors(me : mutable; aSeq : SequenceOfColor from Aspect);
|
||||
---Purpose: Sets the color scale colors.
|
||||
|
||||
SetLabelPosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
|
||||
---Purpose: Sets the color scale labels position concerning color filled rectangles.
|
||||
|
||||
SetTitlePosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
|
||||
---Purpose: Sets the color scale title position.
|
||||
|
||||
SetReversed(me : mutable; aReverse : Boolean from Standard);
|
||||
---Purpose: Sets true if the labels and colors used in reversed order.
|
||||
|
||||
SetLabelAtBorder(me : mutable; anOn : Boolean from Standard);
|
||||
---Purpose: Sets true if the labels placed at border of color filled rectangles.
|
||||
|
||||
--- Size and position management
|
||||
--- Size and position are values relative to view size (between 0 and 1)
|
||||
|
||||
GetSize(me; aWidth : in out Real from Standard;
|
||||
aHeight : in out Real from Standard);
|
||||
---Purpose: Returns the size of color scale.
|
||||
|
||||
GetWidth(me)
|
||||
returns Real from Standard;
|
||||
---Purpose: Returns the width of color scale.
|
||||
|
||||
GetHeight(me)
|
||||
returns Real from Standard;
|
||||
---Purpose: Returns the height of color scale.
|
||||
|
||||
SetSize(me : mutable; aWidth : Real from Standard;
|
||||
aHeight : Real from Standard);
|
||||
---Purpose: Sets the size of color scale.
|
||||
|
||||
SetWidth(me : mutable; aWidth : Real from Standard);
|
||||
---Purpose: Sets the width of color scale.
|
||||
|
||||
SetHeight(me : mutable; aHeight : Real from Standard);
|
||||
---Purpose: Sets the height of color scale.
|
||||
|
||||
GetPosition(me; aX : in out Real from Standard;
|
||||
aY : in out Real from Standard);
|
||||
---Purpose: Returns the position of color scale.
|
||||
|
||||
GetXPosition(me)
|
||||
returns Real from Standard;
|
||||
---Purpose: Returns the X position of color scale.
|
||||
|
||||
GetYPosition(me)
|
||||
returns Real from Standard;
|
||||
---Purpose: Returns the height of color scale.
|
||||
|
||||
SetPosition(me : mutable; aX : Real from Standard;
|
||||
aY : Real from Standard);
|
||||
---Purpose: Sets the position of color scale.
|
||||
|
||||
SetXPosition(me : mutable; aX : Real from Standard);
|
||||
---Purpose: Sets the X position of color scale.
|
||||
|
||||
SetYPosition(me : mutable; aY : Real from Standard);
|
||||
---Purpose: Sets the Y position of color scale.
|
||||
|
||||
GetTextHeight(me)
|
||||
returns Integer from Standard;
|
||||
|
||||
SetTextHeight(me: mutable; aHeigh : Integer from Standard);
|
||||
|
||||
|
||||
---Category: Protected
|
||||
|
||||
|
||||
Initialize
|
||||
returns ColorScale from Aspect
|
||||
is protected;
|
||||
|
||||
SizeHint(me; aWidth : in out Integer from Standard;
|
||||
aHeight : in out Integer from Standard)
|
||||
is protected;
|
||||
|
||||
UpdateColorScale(me : mutable)
|
||||
is virtual protected;
|
||||
|
||||
DrawScale(me : mutable; aBgColor : Color from Quantity;
|
||||
X, Y, W, H : Integer from Standard)
|
||||
is protected;
|
||||
|
||||
BeginPaint(me : mutable)
|
||||
returns Boolean from Standard
|
||||
is virtual protected;
|
||||
|
||||
EndPaint(me : mutable)
|
||||
returns Boolean from Standard
|
||||
is virtual protected;
|
||||
|
||||
PaintRect(me : mutable; X, Y, W, H : Integer from Standard;
|
||||
aColor : Color from Quantity;
|
||||
aFilled : Boolean from Standard = Standard_False)
|
||||
is deferred;
|
||||
|
||||
PaintText(me : mutable; aText : ExtendedString from TCollection;
|
||||
X, Y : Integer from Standard;
|
||||
aColor : Color from Quantity)
|
||||
is deferred;
|
||||
|
||||
TextWidth(me; aText : ExtendedString from TCollection)
|
||||
returns Integer from Standard
|
||||
is deferred;
|
||||
|
||||
TextHeight(me; aText : ExtendedString from TCollection)
|
||||
returns Integer from Standard
|
||||
is deferred;
|
||||
|
||||
---Category: Private
|
||||
|
||||
Format(me)
|
||||
returns AsciiString from TCollection
|
||||
is private;
|
||||
|
||||
GetCurrentLabel(me; anIndex : Integer from Standard)
|
||||
returns ExtendedString from TCollection
|
||||
is private;
|
||||
|
||||
GetCurrentColor(me; anIndex : Integer from Standard)
|
||||
returns Color from Quantity
|
||||
is private;
|
||||
|
||||
GetNumber(me; anIndex : Integer from Standard)
|
||||
returns Real from Standard
|
||||
is private;
|
||||
|
||||
HueFromValue(myclass; aValue : Integer from Standard;
|
||||
aMin : Integer from Standard;
|
||||
aMax : Integer from Standard)
|
||||
returns Integer from Standard
|
||||
is private;
|
||||
|
||||
fields
|
||||
|
||||
myMin, myMax : Real from Standard;
|
||||
myTitle : ExtendedString from TCollection;
|
||||
myFormat : AsciiString from TCollection;
|
||||
myInterval : Integer from Standard;
|
||||
myColorType : TypeOfColorScaleData from Aspect;
|
||||
myLabelType : TypeOfColorScaleData from Aspect;
|
||||
|
||||
myAtBorder : Boolean from Standard;
|
||||
myReversed : Boolean from Standard;
|
||||
|
||||
myColors : SequenceOfColor from Aspect;
|
||||
myLabels : SequenceOfExtendedString from TColStd;
|
||||
|
||||
myLabelPos : TypeOfColorScalePosition from Aspect;
|
||||
myTitlePos : TypeOfColorScalePosition from Aspect;
|
||||
|
||||
myXPos, myYPos : Real from Standard;
|
||||
myWidth, myHeight : Real from Standard;
|
||||
|
||||
myTextHeight : Integer from Standard;
|
||||
|
||||
end ColorScale;
|
648
src/Aspect/Aspect_ColorScale.cxx
Executable file
648
src/Aspect/Aspect_ColorScale.cxx
Executable file
@@ -0,0 +1,648 @@
|
||||
// File: Aspect_ColorScale.cxx
|
||||
// Created: Tue Jun 22 17:44:25 2004
|
||||
// Author: STV
|
||||
//Copyright: Open Cascade 2004
|
||||
|
||||
#include <Aspect_ColorScale.ixx>
|
||||
|
||||
#include <Aspect_ColorMap.hxx>
|
||||
#include <Aspect_ColorMapEntry.hxx>
|
||||
#include <Aspect_SequenceOfColor.hxx>
|
||||
#include <Aspect_TypeOfColorScaleData.hxx>
|
||||
#include <Aspect_TypeOfColorScalePosition.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TColStd_SequenceOfExtendedString.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
Aspect_ColorScale::Aspect_ColorScale()
|
||||
: MMgt_TShared(),
|
||||
myMin( 0.0 ),
|
||||
myMax( 1.0 ),
|
||||
myXPos( 0 ),
|
||||
myYPos( 0 ),
|
||||
myWidth( 0.2 ),
|
||||
myHeight( 1 ),
|
||||
myTitle( "" ),
|
||||
myInterval( 10 ),
|
||||
myFormat( "%.4g" ),
|
||||
myAtBorder( Standard_True ),
|
||||
myReversed( Standard_False ),
|
||||
myColorType( Aspect_TOCSD_AUTO ),
|
||||
myLabelType( Aspect_TOCSD_AUTO ),
|
||||
myLabelPos( Aspect_TOCSP_RIGHT ),
|
||||
myTitlePos( Aspect_TOCSP_CENTER ),
|
||||
myTextHeight(20)
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Real Aspect_ColorScale::GetMin() const
|
||||
{
|
||||
return myMin;
|
||||
}
|
||||
|
||||
Standard_Real Aspect_ColorScale::GetMax() const
|
||||
{
|
||||
return myMax;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::GetRange( Standard_Real& aMin, Standard_Real& aMax ) const
|
||||
{
|
||||
aMin = myMin;
|
||||
aMax = myMax;
|
||||
}
|
||||
|
||||
Aspect_TypeOfColorScaleData Aspect_ColorScale::GetLabelType() const
|
||||
{
|
||||
return myLabelType;
|
||||
}
|
||||
|
||||
Aspect_TypeOfColorScaleData Aspect_ColorScale::GetColorType() const
|
||||
{
|
||||
return myColorType;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorScale::GetNumberOfIntervals() const
|
||||
{
|
||||
return myInterval;
|
||||
}
|
||||
|
||||
TCollection_ExtendedString Aspect_ColorScale::GetTitle() const
|
||||
{
|
||||
return myTitle;
|
||||
}
|
||||
|
||||
TCollection_AsciiString Aspect_ColorScale::GetFormat() const
|
||||
{
|
||||
return myFormat;
|
||||
}
|
||||
|
||||
TCollection_ExtendedString Aspect_ColorScale::GetLabel( const Standard_Integer anIndex ) const
|
||||
{
|
||||
TCollection_ExtendedString aLabel;
|
||||
if ( anIndex >= 0 && anIndex < myLabels.Length() )
|
||||
aLabel = myLabels.Value( anIndex + 1 );
|
||||
return aLabel;
|
||||
}
|
||||
|
||||
Quantity_Color Aspect_ColorScale::GetColor( const Standard_Integer anIndex ) const
|
||||
{
|
||||
Quantity_Color aColor;
|
||||
if ( anIndex >= 0 && anIndex < myColors.Length() )
|
||||
aColor = myColors.Value( anIndex + 1 );
|
||||
return aColor;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::GetLabels( TColStd_SequenceOfExtendedString& aLabels ) const
|
||||
{
|
||||
aLabels.Clear();
|
||||
for ( Standard_Integer i = 1; i <= myLabels.Length(); i++ )
|
||||
aLabels.Append( myLabels.Value( i ) );
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::GetColors( Aspect_SequenceOfColor& aColors ) const
|
||||
{
|
||||
aColors.Clear();
|
||||
for ( Standard_Integer i = 1; i <= myColors.Length(); i++ )
|
||||
aColors.Append( myColors.Value( i ) );
|
||||
}
|
||||
|
||||
Aspect_TypeOfColorScalePosition Aspect_ColorScale::GetLabelPosition() const
|
||||
{
|
||||
return myLabelPos;
|
||||
}
|
||||
|
||||
Aspect_TypeOfColorScalePosition Aspect_ColorScale::GetTitlePosition() const
|
||||
{
|
||||
return myTitlePos;
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_ColorScale::IsReversed() const
|
||||
{
|
||||
return myReversed;
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_ColorScale::IsLabelAtBorder() const
|
||||
{
|
||||
return myAtBorder;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetMin( const Standard_Real aMin )
|
||||
{
|
||||
SetRange( aMin, GetMax() );
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetMax( const Standard_Real aMax )
|
||||
{
|
||||
SetRange( GetMin(), aMax );
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetRange( const Standard_Real aMin, const Standard_Real aMax )
|
||||
{
|
||||
if ( myMin == aMin && myMax == aMax )
|
||||
return;
|
||||
|
||||
myMin = Min( aMin, aMax );
|
||||
myMax = Max( aMin, aMax );
|
||||
|
||||
if ( GetColorType() == Aspect_TOCSD_AUTO )
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetLabelType( const Aspect_TypeOfColorScaleData aType )
|
||||
{
|
||||
if ( myLabelType == aType )
|
||||
return;
|
||||
|
||||
myLabelType = aType;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetColorType( const Aspect_TypeOfColorScaleData aType )
|
||||
{
|
||||
if ( myColorType == aType )
|
||||
return;
|
||||
|
||||
myColorType = aType;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetNumberOfIntervals( const Standard_Integer aNum )
|
||||
{
|
||||
if ( myInterval == aNum || aNum < 1 )
|
||||
return;
|
||||
|
||||
myInterval = aNum;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetTitle( const TCollection_ExtendedString& aTitle )
|
||||
{
|
||||
if ( myTitle == aTitle )
|
||||
return;
|
||||
|
||||
myTitle = aTitle;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetFormat( const TCollection_AsciiString& aFormat )
|
||||
{
|
||||
if ( myFormat == aFormat )
|
||||
return;
|
||||
|
||||
myFormat = aFormat;
|
||||
if ( GetLabelType() == Aspect_TOCSD_AUTO )
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetLabel( const TCollection_ExtendedString& aLabel, const Standard_Integer anIndex )
|
||||
{
|
||||
Standard_Boolean changed = Standard_False;
|
||||
Standard_Integer i = anIndex < 1 ? myLabels.Length() + 1 : anIndex;
|
||||
if ( i <= myLabels.Length() ) {
|
||||
changed = myLabels.Value( i ) != aLabel;
|
||||
myLabels.SetValue( i, aLabel );
|
||||
}
|
||||
else {
|
||||
changed = Standard_True;
|
||||
while ( i > myLabels.Length() )
|
||||
myLabels.Append( TCollection_ExtendedString() );
|
||||
myLabels.SetValue( i, aLabel );
|
||||
}
|
||||
if ( changed )
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetColor(const Quantity_Color& aColor, const Standard_Integer anIndex )
|
||||
{
|
||||
Standard_Boolean changed = Standard_False;
|
||||
Standard_Integer i = anIndex < 1 ? myLabels.Length() + 1 : anIndex;
|
||||
if ( i <= myColors.Length() ) {
|
||||
changed = myColors.Value( i ) != aColor;
|
||||
myColors.SetValue( i, aColor );
|
||||
}
|
||||
else {
|
||||
changed = Standard_True;
|
||||
while ( i > myColors.Length() )
|
||||
myColors.Append( Quantity_Color() );
|
||||
myColors.SetValue( i, aColor );
|
||||
}
|
||||
if ( changed )
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetLabels( const TColStd_SequenceOfExtendedString& aSeq )
|
||||
{
|
||||
myLabels.Clear();
|
||||
for ( Standard_Integer i = 1; i <= aSeq.Length(); i++ )
|
||||
myLabels.Append( aSeq.Value( i ) );
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetColors( const Handle(Aspect_ColorMap)& aMap )
|
||||
{
|
||||
myColors.Clear();
|
||||
if ( !aMap.IsNull() )
|
||||
for ( Standard_Integer i = 1; i <= aMap->Size(); i++ )
|
||||
myColors.Append( aMap->Entry( i ).Color() );
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetColors( const Aspect_SequenceOfColor& aSeq )
|
||||
{
|
||||
myColors.Clear();
|
||||
for ( Standard_Integer i = 1; i <= aSeq.Length(); i++ )
|
||||
myColors.Append( aSeq.Value( i ) );
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetLabelPosition( const Aspect_TypeOfColorScalePosition aPos )
|
||||
{
|
||||
if ( myLabelPos == aPos )
|
||||
return;
|
||||
|
||||
myLabelPos = aPos;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetTitlePosition( const Aspect_TypeOfColorScalePosition aPos )
|
||||
{
|
||||
if ( myTitlePos == aPos )
|
||||
return;
|
||||
|
||||
myTitlePos = aPos;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetReversed( const Standard_Boolean aReverse )
|
||||
{
|
||||
if ( myReversed == aReverse )
|
||||
return;
|
||||
|
||||
myReversed = aReverse;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetLabelAtBorder( const Standard_Boolean anOn )
|
||||
{
|
||||
if ( myAtBorder == anOn )
|
||||
return;
|
||||
|
||||
myAtBorder = anOn;
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::GetPosition( Standard_Real& aX, Standard_Real& aY ) const
|
||||
{
|
||||
aX = myXPos;
|
||||
aY = myYPos;
|
||||
}
|
||||
|
||||
Standard_Real Aspect_ColorScale::GetXPosition() const
|
||||
{
|
||||
return myXPos;
|
||||
}
|
||||
|
||||
Standard_Real Aspect_ColorScale::GetYPosition() const
|
||||
{
|
||||
return myYPos;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetPosition( const Standard_Real aX, const Standard_Real aY )
|
||||
{
|
||||
if ( myXPos == aX && myYPos == aY )
|
||||
return;
|
||||
|
||||
myXPos = aX;
|
||||
myYPos = aY;
|
||||
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetXPosition( const Standard_Real aX )
|
||||
{
|
||||
SetPosition( aX, GetYPosition() );
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetYPosition( const Standard_Real aY )
|
||||
{
|
||||
SetPosition( GetXPosition(), aY );
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::GetSize( Standard_Real& aWidth, Standard_Real& aHeight ) const
|
||||
{
|
||||
aWidth = myWidth;
|
||||
aHeight = myHeight;
|
||||
}
|
||||
|
||||
Standard_Real Aspect_ColorScale::GetWidth() const
|
||||
{
|
||||
return myWidth;
|
||||
}
|
||||
|
||||
Standard_Real Aspect_ColorScale::GetHeight() const
|
||||
{
|
||||
return myHeight;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetSize( const Standard_Real aWidth, const Standard_Real aHeight )
|
||||
{
|
||||
if ( myWidth == aWidth && myHeight == aHeight )
|
||||
return;
|
||||
|
||||
myWidth = aWidth;
|
||||
myHeight = aHeight;
|
||||
|
||||
UpdateColorScale();
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetWidth( const Standard_Real aWidth )
|
||||
{
|
||||
SetSize( aWidth, GetHeight() );
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetHeight( const Standard_Real aHeight )
|
||||
{
|
||||
SetSize( GetWidth(), aHeight );
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SizeHint( Standard_Integer& aWidth, Standard_Integer& aHeight ) const
|
||||
{
|
||||
Standard_Integer num = GetNumberOfIntervals();
|
||||
|
||||
Standard_Integer spacer = 5;
|
||||
Standard_Integer textWidth = 0;
|
||||
Standard_Integer textHeight = TextHeight( "" );
|
||||
Standard_Integer colorWidth = 20;
|
||||
|
||||
if ( GetLabelPosition() != Aspect_TOCSP_NONE )
|
||||
for ( Standard_Integer idx = 0; idx < num; idx++ )
|
||||
textWidth = Max( textWidth, TextWidth( GetCurrentLabel( idx + 1 ) ) );
|
||||
|
||||
Standard_Integer scaleWidth = 0;
|
||||
Standard_Integer scaleHeight = 0;
|
||||
|
||||
Standard_Integer titleWidth = 0;
|
||||
Standard_Integer titleHeight = 0;
|
||||
|
||||
if ( IsLabelAtBorder() ) {
|
||||
num++;
|
||||
if ( GetTitle().Length() )
|
||||
titleHeight += 10;
|
||||
}
|
||||
|
||||
scaleWidth = colorWidth + textWidth + ( textWidth ? 3 : 2 ) * spacer;
|
||||
scaleHeight = (Standard_Integer)( 1.5 * ( num + 1 ) * textHeight );
|
||||
|
||||
if ( GetTitle().Length() ) {
|
||||
titleHeight = TextHeight( GetTitle() ) + spacer;
|
||||
titleWidth = TextWidth( GetTitle() ) + 10;
|
||||
}
|
||||
|
||||
aWidth = Max( titleWidth, scaleWidth );
|
||||
aHeight = scaleHeight + titleHeight;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::DrawScale( const Quantity_Color& aBgColor,
|
||||
const Standard_Integer X, const Standard_Integer Y,
|
||||
const Standard_Integer W, const Standard_Integer H )
|
||||
{
|
||||
if ( !BeginPaint() )
|
||||
return;
|
||||
|
||||
Standard_Integer num = GetNumberOfIntervals();
|
||||
Aspect_TypeOfColorScalePosition labPos = GetLabelPosition();
|
||||
|
||||
Standard_Integer spacer = 5;
|
||||
Standard_Integer textWidth = 0;
|
||||
Standard_Integer textHeight = TextHeight( "" );
|
||||
|
||||
Standard_Boolean drawLabel = GetLabelPosition() != Aspect_TOCSP_NONE;
|
||||
|
||||
TCollection_ExtendedString aTitle = GetTitle();
|
||||
|
||||
Standard_Integer titleWidth = 0;
|
||||
Standard_Integer titleHeight = 0;
|
||||
|
||||
Standard_Integer aGray = (Standard_Integer)(255 * ( aBgColor.Red() * 11 + aBgColor.Green() * 16 + aBgColor.Blue() * 5 ) / 32);
|
||||
Quantity_Color aFgColor( aGray < 128 ? Quantity_NOC_WHITE : Quantity_NOC_BLACK );
|
||||
|
||||
// Draw title
|
||||
if ( aTitle.Length() ) {
|
||||
titleWidth = TextWidth( aTitle );
|
||||
titleHeight = TextHeight( aTitle ) + 2 * spacer;
|
||||
PaintText( aTitle, X + spacer, Y + spacer, aFgColor );
|
||||
}
|
||||
|
||||
Standard_Boolean reverse = IsReversed();
|
||||
|
||||
Aspect_SequenceOfColor colors;
|
||||
TColStd_SequenceOfExtendedString labels;
|
||||
for ( int idx = 0; idx < num; idx++ ) {
|
||||
if ( reverse ) {
|
||||
colors.Append( GetCurrentColor( idx ) );
|
||||
labels.Append( GetCurrentLabel( idx ) );
|
||||
}
|
||||
else {
|
||||
colors.Prepend( GetCurrentColor( idx ) );
|
||||
labels.Prepend( GetCurrentLabel( idx ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( IsLabelAtBorder() ) {
|
||||
if ( reverse )
|
||||
labels.Append( GetCurrentLabel( num ) );
|
||||
else
|
||||
labels.Prepend( GetCurrentLabel( num ) );
|
||||
}
|
||||
|
||||
if ( drawLabel )
|
||||
for ( Standard_Integer i = 1; i <= labels.Length(); i++ )
|
||||
textWidth = Max( textWidth, TextWidth( labels.Value( i ) ) );
|
||||
|
||||
Standard_Integer lab = labels.Length();
|
||||
|
||||
Standard_Real spc = ( H - ( ( Min( lab, 2 ) + Abs( lab - num - 1 ) ) * textHeight ) - titleHeight );
|
||||
Standard_Real val = spc != 0 ? 1.0 * ( lab - Min( lab, 2 ) ) * textHeight / spc : 0;
|
||||
Standard_Real iPart;
|
||||
Standard_Real fPart = modf( val, &iPart );
|
||||
Standard_Integer filter = (Standard_Integer)iPart + ( fPart != 0 ? 1 : 0 );
|
||||
|
||||
Standard_Real step = 1.0 * ( H - ( lab - num + Abs( lab - num - 1 ) ) * textHeight - titleHeight ) / num;
|
||||
|
||||
Standard_Integer ascent = 0;
|
||||
Standard_Integer colorWidth = Max( 5, Min( 20, W - textWidth - 3 * spacer ) );
|
||||
if ( labPos == Aspect_TOCSP_CENTER || !drawLabel )
|
||||
colorWidth = W - 2 * spacer;
|
||||
|
||||
// Draw colors
|
||||
Standard_Integer x = X + spacer;
|
||||
if ( labPos == Aspect_TOCSP_LEFT )
|
||||
x += textWidth + ( textWidth ? 1 : 0 ) * spacer;
|
||||
|
||||
Standard_Real offset = 1.0 * textHeight / 2 * ( lab - num + Abs( lab - num - 1 ) ) + titleHeight;
|
||||
for ( Standard_Integer ci = 1; ci <= colors.Length() && step > 0; ci++ ) {
|
||||
Standard_Integer y = (Standard_Integer)( Y + ( ci - 1 )* step + offset );
|
||||
Standard_Integer h = (Standard_Integer)( Y + ( ci ) * step + offset ) - y;
|
||||
PaintRect( x, y, colorWidth, h, colors.Value( ci ), Standard_True );
|
||||
}
|
||||
|
||||
if ( step > 0 )
|
||||
PaintRect( x - 1, (Standard_Integer)(Y + offset - 1), colorWidth + 2, (Standard_Integer)(colors.Length() * step + 2), aFgColor );
|
||||
|
||||
// Draw labels
|
||||
offset = 1.0 * Abs( lab - num - 1 ) * ( step - textHeight ) / 2 + 1.0 * Abs( lab - num - 1 ) * textHeight / 2;
|
||||
offset += titleHeight;
|
||||
if ( drawLabel && labels.Length() && filter > 0 ) {
|
||||
Standard_Integer i1 = 0;
|
||||
Standard_Integer i2 = lab - 1;
|
||||
Standard_Integer last1( i1 ), last2( i2 );
|
||||
x = X + spacer;
|
||||
switch ( labPos ) {
|
||||
case Aspect_TOCSP_CENTER:
|
||||
x += ( colorWidth - textWidth ) / 2;
|
||||
break;
|
||||
case Aspect_TOCSP_RIGHT:
|
||||
x += colorWidth + spacer;
|
||||
break;
|
||||
}
|
||||
while ( i2 - i1 >= filter || ( i2 == 0 && i1 == 0 ) ) {
|
||||
Standard_Integer pos1 = i1;
|
||||
Standard_Integer pos2 = lab - 1 - i2;
|
||||
if ( filter && !( pos1 % filter ) ) {
|
||||
PaintText( labels.Value( i1 + 1 ), x, (Standard_Integer)( Y + i1 * step + ascent + offset ), aFgColor );
|
||||
last1 = i1;
|
||||
}
|
||||
if ( filter && !( pos2 % filter ) ) {
|
||||
PaintText( labels.Value( i2 + 1 ), x, (Standard_Integer)( Y + i2 * step + ascent + offset ), aFgColor );
|
||||
last2 = i2;
|
||||
}
|
||||
i1++;
|
||||
i2--;
|
||||
}
|
||||
Standard_Integer pos = i1;
|
||||
Standard_Integer i0 = -1;
|
||||
while ( pos <= i2 && i0 == -1 ) {
|
||||
if ( filter && !( pos % filter ) && Abs( pos - last1 ) >= filter && Abs( pos - last2 ) >= filter )
|
||||
i0 = pos;
|
||||
pos++;
|
||||
}
|
||||
|
||||
if ( i0 != -1 )
|
||||
PaintText( labels.Value( i0 + 1 ), x, (Standard_Integer)( Y + i0 * step + ascent + offset ), aFgColor );
|
||||
}
|
||||
|
||||
EndPaint();
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_ColorScale::BeginPaint()
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_ColorScale::EndPaint()
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::UpdateColorScale()
|
||||
{
|
||||
}
|
||||
|
||||
TCollection_AsciiString Aspect_ColorScale::Format() const
|
||||
{
|
||||
return GetFormat();
|
||||
}
|
||||
|
||||
TCollection_ExtendedString Aspect_ColorScale::GetCurrentLabel( const Standard_Integer anIndex ) const
|
||||
{
|
||||
TCollection_ExtendedString aLabel;
|
||||
if ( GetLabelType() == Aspect_TOCSD_USER )
|
||||
aLabel = GetLabel( anIndex );
|
||||
else {
|
||||
Standard_Real val = GetNumber( anIndex );
|
||||
Standard_Character buf[1024];
|
||||
TCollection_AsciiString aFormat = Format();
|
||||
sprintf( buf, aFormat.ToCString(), val );
|
||||
aLabel = TCollection_ExtendedString( buf );
|
||||
}
|
||||
|
||||
return aLabel;
|
||||
}
|
||||
|
||||
Quantity_Color Aspect_ColorScale::GetCurrentColor( const Standard_Integer anIndex ) const
|
||||
{
|
||||
Quantity_Color aColor;
|
||||
if ( GetColorType() == Aspect_TOCSD_USER )
|
||||
aColor = GetColor( anIndex );
|
||||
else
|
||||
aColor = Quantity_Color( HueFromValue( anIndex, 0, GetNumberOfIntervals() - 1 ), 1.0, 1.0, Quantity_TOC_HLS );
|
||||
return aColor;
|
||||
}
|
||||
|
||||
Standard_Real Aspect_ColorScale::GetNumber( const Standard_Integer anIndex ) const
|
||||
{
|
||||
Standard_Real aNum = 0;
|
||||
if ( GetNumberOfIntervals() > 0 )
|
||||
aNum = GetMin() + anIndex * ( Abs( GetMax() - GetMin() ) / GetNumberOfIntervals() );
|
||||
return aNum;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorScale::HueFromValue( const Standard_Integer aValue,
|
||||
const Standard_Integer aMin, const Standard_Integer aMax )
|
||||
{
|
||||
Standard_Integer minLimit( 0 ), maxLimit( 230 );
|
||||
|
||||
Standard_Integer aHue = maxLimit;
|
||||
if ( aMin != aMax )
|
||||
aHue = (Standard_Integer)( maxLimit - ( maxLimit - minLimit ) * ( aValue - aMin ) / ( aMax - aMin ) );
|
||||
|
||||
aHue = Min( Max( minLimit, aHue ), maxLimit );
|
||||
|
||||
return aHue;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_ColorScale::GetTextHeight() const {
|
||||
return myTextHeight;
|
||||
}
|
||||
|
||||
void Aspect_ColorScale::SetTextHeight(const Standard_Integer aHeigh) {
|
||||
myTextHeight = aHeigh;
|
||||
UpdateColorScale ();
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean Aspect_ColorScale::FindColor( const Standard_Real aValue,
|
||||
Quantity_Color& aColor ) const
|
||||
{
|
||||
return FindColor( aValue, myMin, myMax, myInterval, aColor );
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean Aspect_ColorScale::FindColor( const Standard_Real aValue,
|
||||
const Standard_Real aMin,
|
||||
const Standard_Real aMax,
|
||||
const Standard_Integer ColorsCount,
|
||||
Quantity_Color& aColor )
|
||||
{
|
||||
if( aValue<aMin || aValue>aMax || aMax<aMin )
|
||||
return Standard_False;
|
||||
|
||||
else
|
||||
{
|
||||
Standard_Real IntervNumber = 0;
|
||||
if( aValue<aMin )
|
||||
IntervNumber = 0;
|
||||
else if( aValue>aMax )
|
||||
IntervNumber = ColorsCount-1;
|
||||
else if( Abs( aMax-aMin ) > Precision::Approximation() )
|
||||
IntervNumber = Ceiling( Standard_Real( ColorsCount ) * ( aValue - aMin ) / ( aMax - aMin ) );
|
||||
|
||||
Standard_Integer Interv = Standard_Integer( IntervNumber );
|
||||
|
||||
aColor = Quantity_Color( HueFromValue( Interv, 0, ColorsCount - 1 ), 1.0, 1.0, Quantity_TOC_HLS );
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
73
src/Aspect/Aspect_Convert.hxx
Normal file
73
src/Aspect/Aspect_Convert.hxx
Normal file
@@ -0,0 +1,73 @@
|
||||
#ifndef _Aspect_Convert_HeaderFile
|
||||
#define _Aspect_Convert_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Quantity_Parameter.hxx>
|
||||
|
||||
//! Auxiliary functions for DCU <-> Pixels conversions.
|
||||
namespace Aspect_Convert
|
||||
{
|
||||
|
||||
inline Standard_Integer Round (Standard_Real theValue)
|
||||
{
|
||||
return Standard_Integer(theValue + (theValue >= 0 ? 0.5 : -0.5 ));
|
||||
}
|
||||
|
||||
inline void ConvertCoordinates (const Standard_Integer theParentPxSizeX, const Standard_Integer theParentPxSizeY,
|
||||
const Quantity_Parameter theQCenterX, const Quantity_Parameter theQCenterY,
|
||||
const Quantity_Parameter theQSizeX, const Quantity_Parameter theQSizeY,
|
||||
Standard_Integer& thePxLeft, Standard_Integer& thePxTop,
|
||||
Standard_Integer& thePxSizeX, Standard_Integer& thePxSizeY)
|
||||
{
|
||||
Quantity_Parameter theParentSizeMin = Min (theParentPxSizeX, theParentPxSizeY);
|
||||
thePxSizeX = Round (theQSizeX * theParentSizeMin);
|
||||
thePxSizeY = Round (theQSizeY * theParentSizeMin);
|
||||
Standard_Integer thePxCenterX = Round(theQCenterX * Quantity_Parameter (theParentPxSizeX));
|
||||
Standard_Integer thePxCenterY = Round((1.0 - theQCenterY) * Quantity_Parameter (theParentPxSizeY));
|
||||
thePxLeft = thePxCenterX - thePxSizeX / 2;
|
||||
thePxTop = thePxCenterY - thePxSizeY / 2;
|
||||
}
|
||||
|
||||
inline void ConvertCoordinates (const Standard_Integer theParentPxSizeX, const Standard_Integer theParentPxSizeY,
|
||||
const Standard_Integer thePxLeft, const Standard_Integer thePxTop,
|
||||
const Standard_Integer thePxSizeX, const Standard_Integer thePxSizeY,
|
||||
Quantity_Parameter& theQCenterX, Quantity_Parameter& theQCenterY,
|
||||
Quantity_Parameter& theQSizeX, Quantity_Parameter& theQSizeY)
|
||||
{
|
||||
Quantity_Parameter theParentSizeMin = Min (theParentPxSizeX, theParentPxSizeY);
|
||||
theQSizeX = Quantity_Parameter(thePxSizeX) / theParentSizeMin;
|
||||
theQSizeY = Quantity_Parameter(thePxSizeY) / theParentSizeMin;
|
||||
Standard_Integer thePxCenterX = thePxLeft + thePxSizeX / 2;
|
||||
Standard_Integer thePxCenterY = thePxTop + thePxSizeY / 2;
|
||||
theQCenterX = Quantity_Parameter (thePxCenterX) / Quantity_Parameter (theParentPxSizeX);
|
||||
theQCenterY = 1.0 - Quantity_Parameter (thePxCenterY) / Quantity_Parameter (theParentPxSizeY);
|
||||
}
|
||||
|
||||
inline void FitIn (const Standard_Integer theParentPxSizeX, const Standard_Integer theParentPxSizeY,
|
||||
Standard_Integer& thePxLeft, Standard_Integer& thePxTop,
|
||||
Standard_Integer& thePxSizeX, Standard_Integer& thePxSizeY)
|
||||
{
|
||||
if (thePxLeft < 0)
|
||||
{
|
||||
//thePxSizeX -= 2 * thePxLeft;
|
||||
thePxLeft = 0;
|
||||
}
|
||||
if ((thePxLeft + thePxSizeX) > theParentPxSizeX)
|
||||
{
|
||||
thePxSizeX = theParentPxSizeX - thePxLeft;
|
||||
}
|
||||
|
||||
if (thePxTop < 0)
|
||||
{
|
||||
//thePxSizeY -= 2 * thePxTop;
|
||||
thePxTop = 0;
|
||||
}
|
||||
if ((thePxTop + thePxSizeY) > theParentPxSizeY)
|
||||
{
|
||||
thePxSizeY = theParentPxSizeY - thePxTop;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /* _Aspect_Convert_HeaderFile */
|
23
src/Aspect/Aspect_Display.hxx
Executable file
23
src/Aspect/Aspect_Display.hxx
Executable file
@@ -0,0 +1,23 @@
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Aspect_Display.hxx */
|
||||
/*==== Role : The header file of primitive type "Display" from package */
|
||||
/*==== "V3d" */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
/*============================================================================*/
|
||||
|
||||
#ifndef _Aspect_Display_HeaderFile
|
||||
#define _Aspect_Display_HeaderFile
|
||||
|
||||
typedef void* Aspect_Display; /* Display* under UNIX */
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
/*==== Definition de Type ====================================================*/
|
||||
|
||||
#include <Standard_Macro.hxx>
|
||||
class Handle(Standard_Type);
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_Display);
|
||||
|
||||
/*============================================================================*/
|
||||
#endif
|
||||
|
||||
#endif /* _Aspect_Display_HeaderFile */
|
27
src/Aspect/Aspect_Drawable.hxx
Executable file
27
src/Aspect/Aspect_Drawable.hxx
Executable file
@@ -0,0 +1,27 @@
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Aspect_Drawable.hxx */
|
||||
/*==== Role : The header file of primitive type "Handle" from packages */
|
||||
/*==== "Xw" & "WNT" */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
/*============================================================================*/
|
||||
|
||||
#ifndef _Aspect_Drawable_HeaderFile
|
||||
#define _Aspect_Drawable_HeaderFile
|
||||
|
||||
#ifdef WNT
|
||||
typedef void* Aspect_Drawable; /* HDC under WNT */
|
||||
#else
|
||||
typedef unsigned long Aspect_Drawable; /* Window or Pixmap under UNIX */
|
||||
#endif /* WNT */
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
/*==== Definition de Type ====================================================*/
|
||||
|
||||
#include <Standard_Macro.hxx>
|
||||
class Handle(Standard_Type);
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_Drawable);
|
||||
|
||||
/*============================================================================*/
|
||||
#endif
|
||||
|
||||
#endif /* _Aspect_Drawable_HeaderFile */
|
422
src/Aspect/Aspect_Driver.cdl
Executable file
422
src/Aspect/Aspect_Driver.cdl
Executable file
@@ -0,0 +1,422 @@
|
||||
|
||||
-- File: Aspect_Driver.cdl
|
||||
-- Created: Thu Jul 1 09:14:42 1993
|
||||
-- Author: Jean Louis FRENKEL,Gerard GRAS
|
||||
-- <gg@sherlox>
|
||||
-- Update: Fri Jan 30 16:05:00 1998
|
||||
-- <gg@photox>
|
||||
-- Adds <useMFT> parameter in the SetFontMap() method
|
||||
-- and adds the new method UseMFT()
|
||||
-- for using MDTV fonts instead system fonts.
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
deferred class Driver from Aspect inherits TShared from MMgt
|
||||
|
||||
---Purpose: Defines the common behaviour of the output driver.
|
||||
-- Warning: Permits to defines polyline,polygon,marker and text attributes in relation
|
||||
-- with the SINGLE primitives DrawPolyline(),DrawPolygon(),....
|
||||
-- or the INCREMENTAL primitives BeginPolyline(),BeginPolygon(),...
|
||||
-- or the SET of primitives BeginArcs(),BeginMarkers(),...
|
||||
--
|
||||
-- NOTE that :
|
||||
-- The incremental primitives are interesting to used because
|
||||
-- no more arrays are necessary to fill it.
|
||||
-- The set of primitives are interesting to used because this
|
||||
-- increase the drawing performances.
|
||||
|
||||
uses
|
||||
|
||||
ExtendedString from TCollection,
|
||||
Array1OfShortReal from TShort,
|
||||
ColorMap from Aspect,
|
||||
TypeMap from Aspect,
|
||||
WidthMap from Aspect,
|
||||
FontMap from Aspect,
|
||||
MarkMap from Aspect,
|
||||
TypeOfText from Aspect,
|
||||
PlaneAngle from Quantity,
|
||||
Length from Quantity,
|
||||
Factor from Quantity,
|
||||
Ratio from Quantity,
|
||||
Color from Quantity
|
||||
|
||||
raises
|
||||
|
||||
DriverDefinitionError from Aspect,
|
||||
DriverError from Aspect,
|
||||
UndefinedMap from Aspect
|
||||
is
|
||||
|
||||
Initialize;
|
||||
|
||||
EndDraw (me: mutable; Synchronize: Boolean = Standard_False) is deferred;
|
||||
---Purpose: Flush all graphics and Wait after up to date
|
||||
--display when Synchronize is TRUE.
|
||||
|
||||
---------------------------------------------
|
||||
-- Category: Methods to define the attributes
|
||||
---------------------------------------------
|
||||
|
||||
SetColorMap(me: mutable;
|
||||
aColorMap: ColorMap from Aspect)
|
||||
raises DriverError from Aspect is static;
|
||||
---Category: Methods to define the ColorIndexs
|
||||
|
||||
SetTypeMap(me: mutable;
|
||||
aTypeMap: TypeMap from Aspect)
|
||||
raises DriverError from Aspect is static;
|
||||
---Category: Methods to define the TypeIndexs
|
||||
|
||||
SetWidthMap(me: mutable;
|
||||
aWidthMap: WidthMap from Aspect)
|
||||
raises DriverError from Aspect is static;
|
||||
---Category: Methods to define the WidthIndexs
|
||||
|
||||
SetFontMap(me: mutable;
|
||||
aFontMap: FontMap from Aspect;
|
||||
useMFT: Boolean from Standard = Standard_True)
|
||||
raises DriverError from Aspect is static;
|
||||
---Category: Methods to define the FontIndexs
|
||||
---Purpose:
|
||||
-- Sets the current font map to this driver and Enable/Disable
|
||||
-- this driver to use MDTV fonts instead system fonts.
|
||||
|
||||
SetMarkMap(me: mutable;
|
||||
aMarkMap: MarkMap from Aspect)
|
||||
raises DriverError from Aspect is static;
|
||||
---Category: Methods to define the MarkerIndexs
|
||||
|
||||
SetLineAttrib (me: mutable;
|
||||
ColorIndex: Integer from Standard;
|
||||
TypeIndex: Integer from Standard;
|
||||
WidthIndex: Integer from Standard)
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Methods to define the Current Line Attibutes
|
||||
|
||||
SetTextAttrib (me: mutable;
|
||||
ColorIndex: Integer from Standard;
|
||||
FontIndex: Integer from Standard)
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Methods to define the Current Text Attributes
|
||||
|
||||
SetTextAttrib (me: mutable;
|
||||
ColorIndex: Integer from Standard;
|
||||
FontIndex: Integer from Standard;
|
||||
aSlant: PlaneAngle from Quantity;
|
||||
aHScale: Factor from Quantity;
|
||||
aWScale: Factor from Quantity;
|
||||
isUnderlined: Boolean from Standard = Standard_False)
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Methods to define the Current Extended Text Attributes
|
||||
|
||||
SetPolyAttrib (me: mutable;
|
||||
ColorIndex: Integer from Standard;
|
||||
TileIndex: Integer from Standard;
|
||||
DrawEdge: Boolean from Standard = Standard_False)
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Methods to set the poly attributes
|
||||
|
||||
SetMarkerAttrib (me: mutable;
|
||||
ColorIndex: Integer from Standard;
|
||||
WidthIndex: Integer from Standard;
|
||||
FillMarker: Boolean from Standard = Standard_False)
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Methods to define the Current Marker Attributes
|
||||
|
||||
---Category: Images methods:
|
||||
|
||||
IsKnownImage(me: mutable; anImage: Transient from Standard)
|
||||
returns Boolean from Standard
|
||||
is deferred;
|
||||
|
||||
SizeOfImageFile(me; anImageFile: CString from Standard;
|
||||
aWidth,aHeight: out Integer from Standard)
|
||||
returns Boolean from Standard
|
||||
is deferred;
|
||||
|
||||
ClearImage (me: mutable; anImageId: Transient from Standard)
|
||||
raises DriverError from Aspect is deferred;
|
||||
|
||||
ClearImageFile (me: mutable; anImageFile: CString from Standard)
|
||||
raises DriverError from Aspect is deferred;
|
||||
|
||||
DrawImage (me: mutable; anImageId: Transient from Standard;
|
||||
aX, aY: ShortReal from Standard)
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
DrawImageFile (me: mutable; anImageFile: CString from Standard;
|
||||
aX, aY: ShortReal from Standard;
|
||||
aScale: Factor from Quantity = 1.0)
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
FillAndDrawImage (me: mutable; anImageId: Transient from Standard;
|
||||
aX, aY: ShortReal from Standard;
|
||||
aWidth, aHeight: Integer from Standard;
|
||||
anArrayOfPixels: Address from Standard)
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Fills a complete Image .
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
FillAndDrawImage (me: mutable; anImageId: Transient from Standard;
|
||||
aX, aY: ShortReal from Standard;
|
||||
anIndexOfLine, aWidth, aHeight: Integer from Standard;
|
||||
anArrayOfPixels: Address from Standard)
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Fills a line of the Image .
|
||||
-- Warning: 0 <= anIndexOfLine < aHeight
|
||||
-- anIndexOfLine = 0 must be the first call
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
DrawPolyline (me : mutable;
|
||||
aListX, aListY: Array1OfShortReal from TShort)
|
||||
---Level: Public
|
||||
---Purpose: Draw a polyline depending of the SetLineAttrib() attributes.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if <aListX,aListY> have not the same size.
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
DrawPolygon (me : mutable;
|
||||
aListX, aListY: Array1OfShortReal from TShort)
|
||||
---Level: Public
|
||||
---Purpose: Draw a polygon depending of the SetPolyAttrib() attributes.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if <aListX,aListY> have not the same size.
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
DrawSegment (me : mutable;
|
||||
X1, Y1: ShortReal from Standard;
|
||||
X2, Y2: ShortReal from Standard)
|
||||
---Level: Public
|
||||
---Purpose: Draw a segment depending of the SetLineAttrib() attributes.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
DrawText (me : mutable;
|
||||
aText: ExtendedString from TCollection;
|
||||
Xpos: ShortReal from Standard;
|
||||
Ypos: ShortReal from Standard;
|
||||
anAngle: ShortReal from Standard = 0.0;
|
||||
aType: TypeOfText from Aspect = Aspect_TOT_SOLID)
|
||||
---Level: Public
|
||||
---Purpose: Draws a text depending of the SetTextAttrib() attributes.
|
||||
---Warning: Coordinates must be defined in DWU space.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if Text has too many chars (> 1024)
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
DrawPolyText (me : mutable;
|
||||
aText: ExtendedString from TCollection;
|
||||
Xpos: ShortReal from Standard;
|
||||
Ypos: ShortReal from Standard;
|
||||
aMarge: Ratio from Quantity = 0.1;
|
||||
anAngle: ShortReal from Standard = 0.0;
|
||||
aType: TypeOfText from Aspect = Aspect_TOT_SOLID)
|
||||
---Level: Public
|
||||
---Purpose: Draws an framed text depending of the
|
||||
-- SetTextAttrib() and SetPolyAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
-- <aMarge> defines the ratio of the space between the
|
||||
-- polygon borders and the bounding box of the text and
|
||||
-- depending of the height of the text.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if Text has too many chars (> 1024)
|
||||
-- or <aMarge is < 0 or > 1.
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
DrawPoint (me : mutable; X, Y: ShortReal from Standard)
|
||||
---Level: Public
|
||||
---Purpose: Draws a 1 PIXEL point depending of the SetMarkerAttrib()
|
||||
--color attribute or add a point depending of the incremental BeginXxxxxx()
|
||||
--primitive used.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
DrawMarker (me : mutable;
|
||||
aMarker: Integer from Standard;
|
||||
Xpos: ShortReal from Standard;
|
||||
Ypos: ShortReal from Standard;
|
||||
Width: ShortReal from Standard;
|
||||
Height: ShortReal from Standard;
|
||||
Angle: ShortReal from Standard = 0.0)
|
||||
---Level: Public
|
||||
---Purpose: Draws the prevously defined marker <aMarker>
|
||||
--depending of the SetMarkerAttrib() attributes.
|
||||
-- Warning: Coordinates and sizes must be defined in DWU space.
|
||||
-- Angle must be defined in RADIAN.
|
||||
-- A one pixel marker is drawn when aMarker index is undefined.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
DrawArc (me : mutable; X,Y : ShortReal from Standard;
|
||||
anXradius,anYradius : ShortReal from Standard;
|
||||
aStartAngle: ShortReal from Standard = 0.0;
|
||||
anOpenAngle: ShortReal from Standard = 6.283185)
|
||||
returns Boolean
|
||||
---Level: Public
|
||||
---Purpose: Draws an Ellipsoid arc of center <X,Y> and Radius
|
||||
--<anXradius,anYradius> of relative angle <anOpenAngle> from
|
||||
--the base angle <aStartAngle> and depending of the SetLineAttrib() attributes.
|
||||
-- Warning: Returns FALSE if the hardware can't drawing this
|
||||
--primitive properly,application must to simulate it.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if one of <aXradius,aYradius> is <= 0.
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
DrawPolyArc (me : mutable; X,Y : ShortReal from Standard;
|
||||
anXradius,anYradius : ShortReal from Standard;
|
||||
aStartAngle: ShortReal from Standard = 0.0;
|
||||
anOpenAngle: ShortReal from Standard = 6.283185)
|
||||
returns Boolean
|
||||
---Level: Public
|
||||
---Purpose: Draws an filled Ellipsoid arc of center <X,Y> and Radius
|
||||
--<anXradius,anYradius> of relative angle <anOpenAngle> from
|
||||
--the base angle <aStartAngle> and depending of the SetPolyAttrib() attributes.
|
||||
-- Warning: Returns FALSE if the hardware can't drawing this
|
||||
--primitive properly,application must to simulate it.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if one of <aXradius,aYradius> is <= 0.
|
||||
---Category: Methods to draw primitives
|
||||
|
||||
BeginPolyline (me : mutable; aNumber : Integer) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Begin an incremental polyline primitive of <aNumber> of points .
|
||||
-- Warning: Points must be added by the the DrawPoint() method.
|
||||
|
||||
BeginPolygon (me : mutable; aNumber : Integer) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Begin an incremental polygon primitive of <aNumber> of points .
|
||||
-- Warning: Points must be added by the the DrawPoint() method.
|
||||
|
||||
BeginSegments (me : mutable) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of segments .
|
||||
-- Warning: Segments must be added by the DrawSegment() method.
|
||||
|
||||
BeginArcs (me : mutable) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of circles or ellips .
|
||||
-- Warning: Arcs must be added by the DrawArc() methods.
|
||||
|
||||
BeginPolyArcs (me : mutable) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of polygon circles or ellips .
|
||||
-- Warning: Arcs must be added by the DrawPolyArc() methods.
|
||||
|
||||
BeginMarkers (me : mutable) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of markers .
|
||||
-- Warning: Markers must be added by the DrawMarker() method.
|
||||
|
||||
BeginPoints (me : mutable) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of points .
|
||||
-- Warning: Points must be added by the DrawPoint() method.
|
||||
|
||||
ClosePrimitive (me : mutable)
|
||||
---Level: Public
|
||||
---Purpose: Close the last Begining primitive
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if no primitive have been opened by BeginXxxxxx().
|
||||
|
||||
InitializeColorMap(me: mutable;
|
||||
aColorMap: ColorMap from Aspect)
|
||||
raises DriverError from Aspect is deferred protected;
|
||||
---Category: Methods to define the ColorIndexs
|
||||
|
||||
InitializeTypeMap(me: mutable;
|
||||
aTypeMap: TypeMap from Aspect)
|
||||
raises DriverError from Aspect is deferred protected;
|
||||
---Category: Methods to define the TypeIndexs
|
||||
|
||||
InitializeWidthMap(me: mutable;
|
||||
aWidthMap: WidthMap from Aspect)
|
||||
raises DriverError from Aspect is deferred protected;
|
||||
---Category: Methods to define the WidthIndexs
|
||||
|
||||
InitializeFontMap(me: mutable;
|
||||
aFontMap: FontMap from Aspect)
|
||||
raises DriverError from Aspect is deferred protected;
|
||||
---Category: Methods to define the FontIndexs
|
||||
|
||||
InitializeMarkMap(me: mutable;
|
||||
aMarkMap: MarkMap from Aspect)
|
||||
raises DriverError from Aspect is deferred protected;
|
||||
---Category: Methods to define the MarkerIndexs
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
ColorMap(me) returns mutable ColorMap from Aspect
|
||||
raises UndefinedMap from Aspect is static;
|
||||
|
||||
TypeMap(me) returns mutable TypeMap from Aspect
|
||||
raises UndefinedMap from Aspect is static;
|
||||
|
||||
WidthMap(me) returns mutable WidthMap from Aspect
|
||||
raises UndefinedMap from Aspect is static;
|
||||
|
||||
FontMap(me) returns mutable FontMap from Aspect
|
||||
raises UndefinedMap from Aspect is static;
|
||||
|
||||
MarkMap(me) returns mutable MarkMap from Aspect
|
||||
raises UndefinedMap from Aspect is static;
|
||||
|
||||
WorkSpace ( me ; Width,Heigth : out Length from Quantity )
|
||||
is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Available WorkSpace in DWU coordinates
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ; PV : Integer from Standard )
|
||||
returns Length from Quantity is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DWU value depending of
|
||||
-- the PIXEL value.
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ; DV : Length from Quantity )
|
||||
returns Integer from Standard is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL value depending of
|
||||
-- the DWU value.
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ; PX, PY : Integer from Standard ;
|
||||
DX, DY : out Length from Quantity ) is deferred ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DWU position depending of
|
||||
-- the PIXEL position .
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ; DX, DY : Length from Quantity ;
|
||||
PX, PY : out Integer from Standard ) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL position depending of
|
||||
-- the DWU position .
|
||||
---Category: Inquire methods
|
||||
|
||||
UseMFT ( me ) returns Boolean from Standard is static;
|
||||
|
||||
---Level: Advanced
|
||||
---Purpose: Returns TRUE when the driver must use MDTV fonts
|
||||
-- instead system fonts.
|
||||
|
||||
fields
|
||||
myColorMap: ColorMap from Aspect;
|
||||
myTypeMap: TypeMap from Aspect;
|
||||
myWidthMap: WidthMap from Aspect;
|
||||
myFontMap: FontMap from Aspect;
|
||||
myMarkMap: MarkMap from Aspect;
|
||||
myColorMapIsDefined: Boolean from Standard;
|
||||
myWidthMapIsDefined: Boolean from Standard;
|
||||
myTypeMapIsDefined: Boolean from Standard;
|
||||
myFontMapIsDefined: Boolean from Standard;
|
||||
myMarkMapIsDefined: Boolean from Standard;
|
||||
myUseMFT: Boolean from Standard;
|
||||
|
||||
end Driver from Aspect;
|
125
src/Aspect/Aspect_Driver.cxx
Executable file
125
src/Aspect/Aspect_Driver.cxx
Executable file
@@ -0,0 +1,125 @@
|
||||
/***********************************************************************
|
||||
|
||||
FONCTION :
|
||||
----------
|
||||
Classe Aspect_Driver :
|
||||
|
||||
HISTORIQUE DES MODIFICATIONS :
|
||||
--------------------------------
|
||||
|
||||
14-05-98 : GG ; Disable using MFT when the symbol
|
||||
CSF_MDTVFontDirectory is not defined.
|
||||
See dirMFTisDefined changes.
|
||||
|
||||
30-01-98 : GG ; SPEC_MFT
|
||||
L'utilisation des polices MFT devient parametrable.
|
||||
Le driver doit utiliser la methode UseMFT() pour
|
||||
savoir s'il doit utiliser ou non les polices
|
||||
MDTV a la place des polices system.
|
||||
|
||||
-> Modifications dans SetFontMap()
|
||||
-> Nouvelle methode UseMFT()
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include <Aspect_Driver.ixx>
|
||||
#include <OSD_Environment.hxx>
|
||||
|
||||
static Standard_Boolean dirMFTisDefined = Standard_False;
|
||||
|
||||
Aspect_Driver::Aspect_Driver () {
|
||||
|
||||
OSD_Environment CSF_MDTVFontDirectory ;
|
||||
|
||||
char *fontdir , *casroot ;
|
||||
fontdir = getenv("CSF_MDTVFontDirectory" );
|
||||
if ( !fontdir) {
|
||||
casroot = getenv("CASROOT");
|
||||
if ( casroot ) {
|
||||
TCollection_AsciiString CasRootString (casroot);
|
||||
CasRootString += "/src/FontMFT" ;
|
||||
CSF_MDTVFontDirectory = OSD_Environment(CasRootString.ToCString());
|
||||
} else {
|
||||
cout << " CASROOT or CSF_MDTVFontDirectory are mandatory to use this fonctionnality " << endl;
|
||||
Standard_Failure::Raise ( "CSF_MDTVTexturesDirectory and CASROOT not setted " );
|
||||
}
|
||||
} else {
|
||||
CSF_MDTVFontDirectory = OSD_Environment("CSF_MDTVFontDirectory");
|
||||
}
|
||||
TCollection_AsciiString dir(CSF_MDTVFontDirectory.Value());
|
||||
|
||||
dirMFTisDefined = (dir.Length() > 0);
|
||||
myUseMFT = Standard_True;
|
||||
myColorMapIsDefined = Standard_False;
|
||||
myWidthMapIsDefined = Standard_False;
|
||||
myTypeMapIsDefined = Standard_False;
|
||||
myFontMapIsDefined = Standard_False;
|
||||
}
|
||||
|
||||
|
||||
void Aspect_Driver::SetColorMap (const Handle(Aspect_ColorMap)& aColorMap)
|
||||
{
|
||||
myColorMap = aColorMap;
|
||||
this->InitializeColorMap(aColorMap);
|
||||
myColorMapIsDefined = Standard_True;
|
||||
}
|
||||
Handle(Aspect_ColorMap) Aspect_Driver::ColorMap () const {
|
||||
|
||||
Aspect_UndefinedMap_Raise_if(!myColorMapIsDefined,"ColorMap");
|
||||
return myColorMap;
|
||||
}
|
||||
|
||||
|
||||
void Aspect_Driver::SetTypeMap (const Handle(Aspect_TypeMap)& aTypeMap)
|
||||
{
|
||||
myTypeMap = aTypeMap;
|
||||
this->InitializeTypeMap(aTypeMap);
|
||||
myTypeMapIsDefined = Standard_True;
|
||||
}
|
||||
Handle(Aspect_TypeMap) Aspect_Driver::TypeMap () const {
|
||||
|
||||
Aspect_UndefinedMap_Raise_if(!myTypeMapIsDefined,"TypeMap");
|
||||
return myTypeMap;
|
||||
}
|
||||
|
||||
void Aspect_Driver::SetWidthMap (const Handle(Aspect_WidthMap)& aWidthMap)
|
||||
{
|
||||
myWidthMap = aWidthMap;
|
||||
this->InitializeWidthMap(aWidthMap);
|
||||
myWidthMapIsDefined = Standard_True;
|
||||
}
|
||||
Handle(Aspect_WidthMap) Aspect_Driver::WidthMap () const {
|
||||
|
||||
Aspect_UndefinedMap_Raise_if(!myWidthMapIsDefined,"WidthMap");
|
||||
return myWidthMap;
|
||||
}
|
||||
|
||||
void Aspect_Driver::SetFontMap (const Handle(Aspect_FontMap)& aFontMap,
|
||||
const Standard_Boolean useMFT)
|
||||
{
|
||||
myUseMFT = useMFT;
|
||||
myFontMap = aFontMap;
|
||||
this->InitializeFontMap(aFontMap);
|
||||
myFontMapIsDefined = Standard_True;
|
||||
}
|
||||
Handle(Aspect_FontMap) Aspect_Driver::FontMap () const {
|
||||
|
||||
Aspect_UndefinedMap_Raise_if(!myFontMapIsDefined,"FontMap");
|
||||
return myFontMap;
|
||||
}
|
||||
|
||||
void Aspect_Driver::SetMarkMap (const Handle(Aspect_MarkMap)& aMarkMap)
|
||||
{
|
||||
myMarkMap = aMarkMap;
|
||||
this->InitializeMarkMap(aMarkMap);
|
||||
myMarkMapIsDefined = Standard_True;
|
||||
}
|
||||
Handle(Aspect_MarkMap) Aspect_Driver::MarkMap () const {
|
||||
|
||||
Aspect_UndefinedMap_Raise_if(!myMarkMapIsDefined,"MarkMap");
|
||||
return myMarkMap;
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_Driver::UseMFT () const {
|
||||
return myUseMFT & dirMFTisDefined;
|
||||
}
|
108
src/Aspect/Aspect_Edge.cdl
Executable file
108
src/Aspect/Aspect_Edge.cdl
Executable file
@@ -0,0 +1,108 @@
|
||||
--
|
||||
-- File: Aspect_Edge.cdl
|
||||
-- Created: Lundi 4 Novembre 1991
|
||||
-- Author: NW,JPB,CAL
|
||||
--
|
||||
---Copyright: MatraDatavision 1991,1992,1993
|
||||
--
|
||||
|
||||
class Edge from Aspect
|
||||
|
||||
---Version:
|
||||
|
||||
---Purpose: This class allows the definition of an edge.
|
||||
|
||||
---Keywords: Edge, Visible, Invisible, Border, Line, Face
|
||||
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
|
||||
TypeOfEdge from Aspect
|
||||
|
||||
raises
|
||||
|
||||
EdgeDefinitionError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns Edge from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates an edge.
|
||||
|
||||
Create ( AIndex1, AIndex2 : Integer from Standard;
|
||||
AType : TypeOfEdge from Aspect )
|
||||
returns Edge from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Creates an edge from an index of vertices
|
||||
-- in a table of vertices.
|
||||
-- <AType> indicates if this edge is seen or not.
|
||||
-- Warning: Raises EdgeDefinitionError if AIndex1 == AIndex2.
|
||||
raises EdgeDefinitionError from Aspect;
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
SetValues ( me : in out;
|
||||
AIndex1, AIndex2 : Integer from Standard;
|
||||
AType : TypeOfEdge from Aspect )
|
||||
---Level: Public
|
||||
---Purpose: Updates the values of an edge <me>.
|
||||
-- Warning: Raises EdgeDefinitionError if AIndex1 == AIndex2.
|
||||
raises EdgeDefinitionError from Aspect;
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
Values ( me;
|
||||
AIndex1, AIndex2 : out Integer from Standard;
|
||||
AType : out TypeOfEdge from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Returns the index of the vertices and the
|
||||
-- type of edge <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
FirstIndex ( me )
|
||||
returns Integer from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the index of the begin of the edge <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
LastIndex ( me )
|
||||
returns Integer from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the index of the end of the edge <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
Type ( me)
|
||||
returns TypeOfEdge from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns the type of the edge <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
--
|
||||
-- Class : Aspect_Edge
|
||||
--
|
||||
-- Purpose : Declaration of variables specific to edges
|
||||
--
|
||||
-- Reminder : An edge is defined by :
|
||||
-- - two vertices referenced by indices
|
||||
-- - its visibility
|
||||
--
|
||||
|
||||
-- indices of the vertices
|
||||
MyBegin : Integer from Standard;
|
||||
MyEnd : Integer from Standard;
|
||||
|
||||
-- the visibility
|
||||
MyVisibility : TypeOfEdge from Aspect;
|
||||
|
||||
end Edge;
|
96
src/Aspect/Aspect_Edge.cxx
Executable file
96
src/Aspect/Aspect_Edge.cxx
Executable file
@@ -0,0 +1,96 @@
|
||||
|
||||
// File Aspect_Edge.cxx
|
||||
// Created Fevrier 1992
|
||||
// Author NW,JPB,CAL
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux aretes
|
||||
|
||||
//-Warning Une arete est definie par :
|
||||
// - les 2 sommets references par des indices
|
||||
// - la visibilite
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_Edge.ixx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// -- les indices des sommets extremite
|
||||
// MyBegin : Standard_Integer;
|
||||
// MyEnd : Standard_Integer;
|
||||
|
||||
// -- la visibilite
|
||||
// MyVisibility : TypeOfEdge;
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_Edge::Aspect_Edge () {
|
||||
|
||||
MyBegin = 0;
|
||||
MyEnd = 0;
|
||||
MyVisibility = Aspect_TOE_INVISIBLE;
|
||||
|
||||
}
|
||||
|
||||
Aspect_Edge::Aspect_Edge (const Standard_Integer AIndex1, const Standard_Integer AIndex2, const Aspect_TypeOfEdge AType) {
|
||||
|
||||
if (AIndex1 == AIndex2)
|
||||
Aspect_EdgeDefinitionError::Raise ("Bad index for the edge");
|
||||
|
||||
MyBegin = AIndex1;
|
||||
MyEnd = AIndex2;
|
||||
MyVisibility = AType;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_Edge::SetValues (const Standard_Integer AIndex1, const Standard_Integer AIndex2, const Aspect_TypeOfEdge AType) {
|
||||
|
||||
if (AIndex1 == AIndex2)
|
||||
Aspect_EdgeDefinitionError::Raise ("Bad index for the edge");
|
||||
|
||||
MyBegin = AIndex1;
|
||||
MyEnd = AIndex2;
|
||||
MyVisibility = AType;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_Edge::Values (Standard_Integer& AIndex1, Standard_Integer& AIndex2, Aspect_TypeOfEdge& AType) const {
|
||||
|
||||
AIndex1 = MyBegin;
|
||||
AIndex2 = MyEnd;
|
||||
AType = MyVisibility;
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_Edge::FirstIndex () const {
|
||||
|
||||
return (MyBegin);
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_Edge::LastIndex () const {
|
||||
|
||||
return (MyEnd);
|
||||
|
||||
}
|
||||
|
||||
Aspect_TypeOfEdge Aspect_Edge::Type () const {
|
||||
|
||||
return (MyVisibility);
|
||||
|
||||
}
|
14
src/Aspect/Aspect_FStream.cxx
Executable file
14
src/Aspect/Aspect_FStream.cxx
Executable file
@@ -0,0 +1,14 @@
|
||||
// File: Aspect_FStream.cxx
|
||||
// Created: Wed Aug 24 09:26:14 1994
|
||||
// Author: Modelistation
|
||||
// <model@bravox>
|
||||
|
||||
|
||||
#include <Aspect_FStream.hxx>
|
||||
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_FStream)
|
||||
{
|
||||
static Handle(Standard_Type) _atype =
|
||||
new Standard_Type("Aspect_FStream",sizeof(Aspect_FStream));
|
||||
return _atype;
|
||||
}
|
12
src/Aspect/Aspect_FStream.hxx
Executable file
12
src/Aspect/Aspect_FStream.hxx
Executable file
@@ -0,0 +1,12 @@
|
||||
|
||||
#ifndef _Aspect_FStream_HeaderFile
|
||||
#define _Aspect_FStream_HeaderFile
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
typedef ofstream* Aspect_FStream;
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_FStream);
|
||||
|
||||
#endif
|
69
src/Aspect/Aspect_FontMap.cdl
Executable file
69
src/Aspect/Aspect_FontMap.cdl
Executable file
@@ -0,0 +1,69 @@
|
||||
--
|
||||
-- File: Aspect_FontMap.cdl
|
||||
-- Created: 07/09/93
|
||||
-- Author: GG
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
class FontMap from Aspect inherits TShared from MMgt
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a FontMap object.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
uses
|
||||
FontStyle from Aspect,
|
||||
FontMapEntry from Aspect,
|
||||
SequenceOfFontMapEntry from Aspect
|
||||
|
||||
raises
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable FontMap from Aspect;
|
||||
|
||||
AddEntry (me : mutable; AnEntry : FontMapEntry from Aspect)
|
||||
---Level: Public
|
||||
---Purpose: Adds an entry in the font map <me>.
|
||||
-- Warning: Raises BadAccess if FontMap size is exceeded.
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
AddEntry (me : mutable; aStyle : FontStyle from Aspect)
|
||||
returns Integer from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Search an identical font style entry in the font map <me>
|
||||
-- and returns the FontMapEntry Index if exist.
|
||||
-- Or add a new entry and returns the computed FontMapEntry index used.
|
||||
|
||||
Size( me ) returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Allocated fontmap Size
|
||||
|
||||
Index( me ; aFontmapIndex : Integer ) returns Integer from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the FontMapEntry.Index of the FontMap
|
||||
-- at rank <aFontmapIndex> .
|
||||
raises BadAccess from Aspect is static;
|
||||
---Trigger: Raises BadAccess if the index less than 1 or
|
||||
-- greater than Size.
|
||||
|
||||
Dump( me ) ;
|
||||
|
||||
Entry ( me ;
|
||||
AnIndex : Integer from Standard )
|
||||
returns FontMapEntry from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Returns the Font map entry with the index <AnIndex>.
|
||||
-- Warning: Raises BadAccess if the index less than 1
|
||||
-- or greater than Size.
|
||||
raises BadAccess from Aspect is static;
|
||||
|
||||
fields
|
||||
|
||||
mydata : SequenceOfFontMapEntry from Aspect is protected;
|
||||
|
||||
end FontMap ;
|
107
src/Aspect/Aspect_FontMap.cxx
Executable file
107
src/Aspect/Aspect_FontMap.cxx
Executable file
@@ -0,0 +1,107 @@
|
||||
|
||||
// File Aspect_FontMap.cxx
|
||||
// Created Septembre 1993
|
||||
// Author GG
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux Ensembles
|
||||
// de Fontures de texts
|
||||
|
||||
//-Warning Une FontMap est definie par un ensemble de FontMapEntries
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_FontMap.ixx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// mydata : SequenceOfFontMapEntry from Aspect is protected
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_FontMap::Aspect_FontMap( ) {
|
||||
Aspect_FontMapEntry theDefaultEntry;
|
||||
|
||||
AddEntry(theDefaultEntry);
|
||||
}
|
||||
|
||||
void Aspect_FontMap::AddEntry (const Aspect_FontMapEntry& AnEntry) {
|
||||
Standard_Integer i,index = AnEntry.Index();
|
||||
Aspect_FontMapEntry theEntry;
|
||||
|
||||
for( i=1 ; i<=mydata.Length() ; i++ ) {
|
||||
theEntry = mydata.Value(i);
|
||||
if( index == theEntry.Index() ) break;
|
||||
}
|
||||
|
||||
if( i > mydata.Length() ) {
|
||||
mydata.Append( AnEntry );
|
||||
} else {
|
||||
mydata.SetValue(i,AnEntry);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_FontMap::AddEntry (const Aspect_FontStyle &aStyle) {
|
||||
Aspect_FontMapEntry theEntry ;
|
||||
Standard_Integer i,maxindex = 0 ;
|
||||
|
||||
for( i=1 ; i<=mydata.Length() ; i++ ) {
|
||||
theEntry = mydata.Value(i) ;
|
||||
maxindex = Max(maxindex,theEntry.Index()) ;
|
||||
if( theEntry.Type() == aStyle ) return theEntry.Index() ;
|
||||
}
|
||||
|
||||
maxindex++ ;
|
||||
theEntry.SetValue(maxindex,aStyle) ;
|
||||
mydata.Append( theEntry ) ;
|
||||
return maxindex ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_FontMap::Size() const {
|
||||
|
||||
return mydata.Length() ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_FontMap::Index(const Standard_Integer anIndex) const {
|
||||
|
||||
if( anIndex < 1 || anIndex > Size() ) {
|
||||
Aspect_BadAccess::Raise ("Undefined fontmap Index");
|
||||
}
|
||||
|
||||
Aspect_FontMapEntry theEntry = mydata.Value(anIndex) ;
|
||||
|
||||
return theEntry.Index() ;
|
||||
}
|
||||
|
||||
Aspect_FontMapEntry Aspect_FontMap::Entry (const Standard_Integer AnIndex) const {
|
||||
|
||||
if( AnIndex < 1 || AnIndex > mydata.Length() )
|
||||
Aspect_BadAccess::Raise ("Aspect_FontMap::Entry Bad Index");
|
||||
|
||||
return mydata.Value(AnIndex);
|
||||
}
|
||||
|
||||
void Aspect_FontMap::Dump () const {
|
||||
|
||||
Standard_Integer i ;
|
||||
|
||||
cout << "Fontmap Dump-->\n" ;
|
||||
|
||||
for ( i = 1 ; i <= Size() ; i++ ) (Entry(i)).Dump() ;
|
||||
|
||||
cout << "<--End Fontmap Dump\n" ;
|
||||
}
|
95
src/Aspect/Aspect_FontMapEntry.cdl
Executable file
95
src/Aspect/Aspect_FontMapEntry.cdl
Executable file
@@ -0,0 +1,95 @@
|
||||
|
||||
--
|
||||
-- File: Aspect_FontMapEntry.cdl
|
||||
-- Created: 07/09/93
|
||||
-- Author: GG
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
class FontMapEntry from Aspect
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a fontmap entry.
|
||||
-- A fontmap entry is an association beetwen
|
||||
-- a FontStyle object and an index in the fontmap.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
|
||||
FontStyle from Aspect
|
||||
|
||||
raises
|
||||
|
||||
OutOfRange from Standard,
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns FontMapEntry from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates an unallocated fontmap entry
|
||||
|
||||
Create ( index : Integer from Standard;
|
||||
style : FontStyle from Aspect)
|
||||
returns FontMapEntry;
|
||||
---Level: Public
|
||||
---Purpose: Creates an allocated fontmap entry
|
||||
|
||||
Create ( entry : FontMapEntry from Aspect )
|
||||
returns FontMapEntry
|
||||
---Level: Public
|
||||
---Purpose: Creates an allocated fontmap entry.
|
||||
-- Warning: Raises error if the fontmap entry <entry> is unallocated.
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
SetValue ( me: in out; index : Integer from Standard;
|
||||
style : FontStyle from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Sets fontmap entry value and allocates it.
|
||||
|
||||
SetValue ( me: in out; entry : FontMapEntry from Aspect);
|
||||
---Level: Public
|
||||
---Purpose: Sets fontmap entry value and allocates it.
|
||||
---C++: alias operator =
|
||||
|
||||
SetType ( me: in out; Style : FontStyle from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Sets the line style of fontmap entry.
|
||||
|
||||
Type ( me ) returns FontStyle from Aspect
|
||||
---Warning: Raises error if the fontmap entry is unallocated .
|
||||
raises BadAccess from Aspect;
|
||||
---C++: return const &
|
||||
|
||||
SetIndex ( me: in out; index : Integer from Standard);
|
||||
---Level: Public
|
||||
---Purpose: Sets index value of a fontmap entry.
|
||||
|
||||
Index ( me ) returns Integer from Standard
|
||||
---Warning: Raises error if the fontmap entry is unallocated .
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
Free ( me : in out );
|
||||
---Level: Public
|
||||
---Purpose: Unallocates the fontmap entry.
|
||||
|
||||
IsAllocated ( me ) returns Boolean from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns True if the fontmap entry is allocated.
|
||||
-- Warning: A fontmap entry is allocated when the font and
|
||||
-- the index is defined.
|
||||
|
||||
Dump( me ) ;
|
||||
fields
|
||||
|
||||
MyType : FontStyle from Aspect;
|
||||
MyIndex : Integer from Standard;
|
||||
MyTypeIsDef : Boolean from Standard;
|
||||
MyIndexIsDef : Boolean from Standard;
|
||||
|
||||
end FontMapEntry from Aspect;
|
158
src/Aspect/Aspect_FontMapEntry.cxx
Executable file
158
src/Aspect/Aspect_FontMapEntry.cxx
Executable file
@@ -0,0 +1,158 @@
|
||||
|
||||
// File Aspect_FontMapEntry.cxx
|
||||
// Created Septembre 1993
|
||||
// Author GG
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux Entries de
|
||||
// Fontures de texts
|
||||
|
||||
//-Warning Une entry est definie par un index associee a une Font style
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_FontMapEntry.ixx>
|
||||
#include <Aspect_Units.hxx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// MyType : FontStyle from Aspect
|
||||
// MyIndex : Integer from Standard
|
||||
// MyTypeIsDef : Boolean from Standard
|
||||
// MyIndexIsDef : Boolean from Standard
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_FontMapEntry::Aspect_FontMapEntry() {
|
||||
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = 0;
|
||||
MyType.SetValues (Aspect_TOF_DEFAULT,3.0 MILLIMETER);
|
||||
|
||||
}
|
||||
|
||||
Aspect_FontMapEntry::Aspect_FontMapEntry (const Standard_Integer index, const Aspect_FontStyle &style) {
|
||||
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
MyType = style;
|
||||
|
||||
}
|
||||
|
||||
Aspect_FontMapEntry::Aspect_FontMapEntry (const Aspect_FontMapEntry& entry) {
|
||||
|
||||
if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
|
||||
Aspect_BadAccess::Raise("Unallocated FontMapEntry") ;
|
||||
}
|
||||
else {
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = entry.MyIndex;
|
||||
MyType = entry.MyType;
|
||||
}
|
||||
}
|
||||
|
||||
void Aspect_FontMapEntry::SetValue (const Standard_Integer index, const Aspect_FontStyle &style) {
|
||||
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
MyType = style;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_FontMapEntry::SetValue (const Aspect_FontMapEntry& entry) {
|
||||
|
||||
if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
|
||||
Aspect_BadAccess::Raise("Unallocated FontMapEntry") ;
|
||||
}
|
||||
else {
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = entry.MyIndex;
|
||||
MyType = entry.MyType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Aspect_FontMapEntry::SetType (const Aspect_FontStyle &style) {
|
||||
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyType = style;
|
||||
|
||||
}
|
||||
|
||||
const Aspect_FontStyle& Aspect_FontMapEntry::Type () const {
|
||||
|
||||
if ( !MyTypeIsDef || !MyIndexIsDef )
|
||||
Aspect_BadAccess::Raise("Unallocated FontMapEntry") ;
|
||||
|
||||
return MyType;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_FontMapEntry::SetIndex (const Standard_Integer index) {
|
||||
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_FontMapEntry::Index () const {
|
||||
|
||||
if ( !MyTypeIsDef || !MyIndexIsDef )
|
||||
Aspect_BadAccess::Raise("Unallocated FontMapEntry");
|
||||
|
||||
return MyIndex;
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_FontMapEntry::IsAllocated () const {
|
||||
|
||||
return ( MyTypeIsDef && MyIndexIsDef ) ;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_FontMapEntry::Free () {
|
||||
|
||||
MyTypeIsDef = Standard_False;
|
||||
MyIndexIsDef = Standard_False;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_FontMapEntry::Dump () const
|
||||
{
|
||||
Aspect_TypeOfFont style = MyType.Style();
|
||||
Standard_CString string = MyType.Value();
|
||||
Standard_Real size = MyType.Size();
|
||||
Standard_Real slant = MyType.Slant();
|
||||
Standard_Integer length = MyType.Length();
|
||||
Standard_Boolean capsheight = MyType.CapsHeight();
|
||||
|
||||
cout << " Aspect_FontMapEntry::Dump ()\n";
|
||||
cout << " MyTypeIsDef : " << (MyTypeIsDef ? "True\n" : "False\n");
|
||||
cout << " MyIndexIsDef : " << (MyIndexIsDef ? "True\n" : "False\n");
|
||||
cout << " FontStyle : " << (Standard_Integer) style << " Size : " << size
|
||||
<< " Slant : " << slant << endl;
|
||||
cout << " CapsHeight : " << (capsheight ? "True\n" : "False\n");
|
||||
cout << " FontStyle length : " << length << "\n";
|
||||
if( length ) cout << " FontString : " << string << "\n";
|
||||
MyType.Dump ();
|
||||
cout << " ------------------------------" << endl << flush;
|
||||
}
|
363
src/Aspect/Aspect_FontStyle.cdl
Executable file
363
src/Aspect/Aspect_FontStyle.cdl
Executable file
@@ -0,0 +1,363 @@
|
||||
--
|
||||
-- File: Aspect_FontStyle.cdl
|
||||
-- Created: Mardi 7 Septembre 1993
|
||||
-- Author: GG
|
||||
--
|
||||
---Copyright: MatraDatavision 1991-1993
|
||||
--
|
||||
|
||||
class FontStyle from Aspect
|
||||
|
||||
---Version:
|
||||
|
||||
---Purpose: This class defines a Font Style.
|
||||
-- The Style can be Predefined or defined by the user
|
||||
|
||||
---Keywords: FontStyle
|
||||
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
|
||||
Length from Quantity,
|
||||
PlaneAngle from Quantity,
|
||||
TypeOfFont from Aspect,
|
||||
AsciiString from TCollection
|
||||
|
||||
raises
|
||||
|
||||
FontStyleDefinitionError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns FontStyle from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Creates a font style with the default values of
|
||||
-- FontStyle type : DEFAULT
|
||||
--
|
||||
raises FontStyleDefinitionError from Aspect;
|
||||
-- if the maximum number of font style is exceeded
|
||||
|
||||
Create ( Type : TypeOfFont from Aspect;
|
||||
Size : Length from Quantity;
|
||||
Slant : PlaneAngle from Quantity = 0.0;
|
||||
CapsHeight : Boolean from Standard = Standard_False)
|
||||
returns FontStyle from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Creates the font style <Type> depending of
|
||||
-- Size given in the basic LENGTH unit and Slant in
|
||||
-- the basic PLANE ANGLE unit.
|
||||
-- When CapsHeight is TRUE the size defines the
|
||||
-- ascent height of the font;if FALSE,the size
|
||||
-- defines the ascent+descent part of the font.
|
||||
raises FontStyleDefinitionError from Aspect;
|
||||
-- if the Size is <= 0.
|
||||
|
||||
Create ( Style : CString from Standard;
|
||||
Size : Length from Quantity;
|
||||
Slant : PlaneAngle from Quantity = 0.0;
|
||||
CapsHeight : Boolean from Standard = Standard_False)
|
||||
returns FontStyle from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Creates a font style from Adobe font style descriptor
|
||||
-- depending of Size given in MM and Slant in RADIAN.
|
||||
-- When CapsHeight is TRUE the size defines the
|
||||
-- ascent height of the font;if FALSE,the size
|
||||
-- defines the ascent+descent part of the font.
|
||||
-- Font Style Descriptor must be :
|
||||
-- Simple form is "family" Ex: "helvetica"
|
||||
-- More complex form is "family-weight" Ex: "helvetica-bold"
|
||||
-- Full form is :
|
||||
-- "-foundry-family-weight-slant-swdth-adstyl-pixelsize"
|
||||
-- "-pointsize-resx-resy-spacing-avgWidth-registry-encoding"
|
||||
-- where each field must be replaced by an "*"
|
||||
-- Warning: create the smalest font size if the foundry height
|
||||
--and the <Size> are null.
|
||||
raises FontStyleDefinitionError from Aspect;
|
||||
-- if <Style> is empty or don't have an normalized X format
|
||||
|
||||
Create ( Style : CString from Standard)
|
||||
returns FontStyle from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Creates a transformable font with the full font name <Style>
|
||||
-- given in the XLFD descriptor :
|
||||
-- "-foundry-family-weight-slant-swidth-adstyl-pixelsize-pointsize-
|
||||
-- resx-resy-spacing-avdWidth-registry-encoding".
|
||||
-- The fields pixelsize ,pointsize,resx,resy are sets to 0
|
||||
-- and all unknown fields sets to '*'.
|
||||
-- Example: "adobe-helvetica-bold-*-*-*-0-0-0-0-*-*-iso8859-*"
|
||||
-- Warning: the height and slant of the font is supposed to be NULL
|
||||
-- and computed dynamically at the drawing text time.
|
||||
raises FontStyleDefinitionError from Aspect;
|
||||
---Trigger: If <Style> is empty or dont't have an XLFD font descriptor.
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
Assign ( me : in out ;
|
||||
Other : FontStyle from Aspect )
|
||||
returns FontStyle from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Updates the font style <me> from the definition of the
|
||||
-- font style <Other>.
|
||||
---Category: Methods to modify the class definition
|
||||
---C++: alias operator =
|
||||
---C++: return &
|
||||
|
||||
SetValues ( me : in out ;
|
||||
Type : TypeOfFont from Aspect;
|
||||
Size : Length from Quantity;
|
||||
Slant : PlaneAngle from Quantity = 0.0;
|
||||
CapsHeight : Boolean from Standard = Standard_False)
|
||||
---Level: Public
|
||||
---Purpose: Updates the font style <me> from the definition of the
|
||||
-- font style <Type>.
|
||||
raises FontStyleDefinitionError from Aspect;
|
||||
-- if the Size is <= 0.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetValues ( me : in out ;
|
||||
Style : CString from Standard;
|
||||
Size : Length from Quantity;
|
||||
Slant : PlaneAngle from Quantity = 0.0;
|
||||
CapsHeight : Boolean from Standard = Standard_False)
|
||||
---Level: Public
|
||||
---Purpose: Updates a font style with the new Abode font descriptor
|
||||
-- Warning: create the smalest font size if the foundry height
|
||||
--and the <Size> are null.
|
||||
raises FontStyleDefinitionError from Aspect;
|
||||
---Trigger: If <Style> is empty or dont't have an normalized X format.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetValues ( me : in out ;
|
||||
Style : CString from Standard)
|
||||
---Level: Public
|
||||
---Purpose: Updates a font style with the new XLFD font descriptor
|
||||
raises FontStyleDefinitionError from Aspect;
|
||||
---Trigger: If <Style> is empty or dont't have an XLFD font descriptor.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetFamily (me : in out;
|
||||
aName: CString from Standard);
|
||||
---Level: Public
|
||||
---Purpose: Sets the family of the font.
|
||||
|
||||
SetWeight (me : in out;
|
||||
aName: CString from Standard);
|
||||
---Level: Public
|
||||
---Purpose: Sets the weight of the font.
|
||||
|
||||
SetRegistry (me : in out;
|
||||
aName: CString from Standard);
|
||||
---Level: Public
|
||||
---Purpose: Sets the registry of the font.
|
||||
|
||||
SetEncoding (me : in out;
|
||||
aName: CString from Standard);
|
||||
---Level: Public
|
||||
---Purpose: Sets the encoding of the font.
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
Style ( me )
|
||||
returns TypeOfFont from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns the type of the font style <me>
|
||||
---Category: Inquire methods
|
||||
|
||||
Length ( me )
|
||||
returns Integer from Standard ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the string components length of the
|
||||
-- font style descriptor
|
||||
---Category: Inquire methods
|
||||
|
||||
Value ( me )
|
||||
returns CString from Standard ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the String component of a font style
|
||||
---Category: Inquire methods
|
||||
|
||||
Size ( me )
|
||||
returns Length from Quantity ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Size component of a font style
|
||||
---Category: Inquire methods
|
||||
|
||||
Slant ( me )
|
||||
returns PlaneAngle from Quantity ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Slant component of a font style
|
||||
---Category: Inquire methods
|
||||
|
||||
CapsHeight( me )
|
||||
returns Boolean from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the CapsHeight component of a font style
|
||||
---Category: Inquire methods
|
||||
|
||||
AliasName (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns a shorter font name which identify the
|
||||
-- main characteristics of the fonts.
|
||||
---Example: "helvetica-bold"
|
||||
|
||||
FullName (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the full normalized font name
|
||||
|
||||
Foundry (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the foundry of the font.
|
||||
---Example: "adobe"
|
||||
|
||||
Family (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the family of the font.
|
||||
---Example: "helvetica"
|
||||
|
||||
Weight (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the weight of the font.
|
||||
---Example: "bold"
|
||||
|
||||
Registry (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the char set registry of the font.
|
||||
---Example: "iso8859"
|
||||
|
||||
Encoding (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the char set encoding of the font.
|
||||
---Example: "1"
|
||||
|
||||
SSlant (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the slant of the font.
|
||||
---Example: "i"
|
||||
|
||||
SWidth (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the width name of the font.
|
||||
---Example: "normal"
|
||||
|
||||
SStyle (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the style name of the font.
|
||||
---Example: "serif"
|
||||
|
||||
SPixelSize (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the pixel size of the font.
|
||||
|
||||
SPointSize (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the point size of the font.
|
||||
|
||||
SResolutionX (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the resolution X of the font.
|
||||
|
||||
SResolutionY (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the resolution Y of the font.
|
||||
|
||||
SSpacing (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the spacing of the font.
|
||||
---Example: "p"
|
||||
|
||||
SAverageWidth (me)
|
||||
returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the average width of the font.
|
||||
---Example: "90"
|
||||
|
||||
Dump (me);
|
||||
---Level: Public
|
||||
---Purpose: Dumps the font attributes.
|
||||
|
||||
|
||||
IsEqual(me; Other : FontStyle from Aspect) returns Boolean;
|
||||
---C++: alias operator==
|
||||
|
||||
IsNotEqual(me; Other : FontStyle from Aspect) returns Boolean;
|
||||
---C++: alias operator!=
|
||||
|
||||
----------------------------
|
||||
-- Category: Private methods
|
||||
----------------------------
|
||||
|
||||
SetPredefinedStyle ( me : in out ;
|
||||
Type : TypeOfFont from Aspect;
|
||||
Size : Length from Quantity;
|
||||
Slant : PlaneAngle from Quantity;
|
||||
CapsHeight : Boolean from Standard)
|
||||
---Level: Internal
|
||||
---Purpose: Set MyFontString with the predefined style value
|
||||
-- and size according of type
|
||||
---Category: Private methods
|
||||
raises FontStyleDefinitionError from Aspect is private;
|
||||
-- if the Type is USERDEFINED !
|
||||
|
||||
Normalize (myclass;
|
||||
aFontName: CString from Standard;
|
||||
aSize: in out Real from Standard)
|
||||
returns CString from Standard is private;
|
||||
---Purpose: Returns a normalized descriptor from the font name
|
||||
-- <aFontName>
|
||||
|
||||
Field (myclass;
|
||||
aFontName: AsciiString from TCollection;
|
||||
aRank: Integer from Standard)
|
||||
returns CString from Standard is private;
|
||||
---Purpose: Returns the field at position <aRank>
|
||||
-- from the font name <aFontName>.
|
||||
|
||||
SetField (myclass;
|
||||
aFontName: AsciiString from TCollection;
|
||||
aField: CString from Standard;
|
||||
aRank: Integer from Standard)
|
||||
returns CString from Standard is private;
|
||||
---Purpose: Sets the field at position <aRank>
|
||||
-- of the fontname <aFontName>
|
||||
-- from the field name <aField>.
|
||||
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
--
|
||||
-- Class : Aspect_FontStyle
|
||||
--
|
||||
-- Purpose : Declaration of variables specific to font styles
|
||||
--
|
||||
|
||||
MyFontType : TypeOfFont from Aspect is protected;
|
||||
MyStyle : AsciiString from TCollection is protected;
|
||||
MyFontName : AsciiString from TCollection is protected;
|
||||
MyFontSize : Real from Standard is protected;
|
||||
MyFontSlant : Real from Standard is protected;
|
||||
MyCapsHeight : Boolean from Standard is protected;
|
||||
|
||||
end FontStyle;
|
625
src/Aspect/Aspect_FontStyle.cxx
Executable file
625
src/Aspect/Aspect_FontStyle.cxx
Executable file
@@ -0,0 +1,625 @@
|
||||
//GG_040298 eliminer les variables statiques globales.
|
||||
|
||||
#define PRO5676 //GG_020197
|
||||
// Donner la possibillite d'exprimer la taille
|
||||
// par rapport a la hauteur totale du caractere ou par
|
||||
// rapport a la hauteur "ascent" situee au dessus de la
|
||||
// ligne de base.
|
||||
// (CapsHeight flag)
|
||||
//
|
||||
|
||||
//GG_160498 etude G1343 gerer les polices transformables pour
|
||||
// l'utilisation de MFT_FontManager.
|
||||
|
||||
// =====================================================================
|
||||
// DCB_120598 study S3553. Platform specific code has been deleted
|
||||
// ("#ifdef WNT") to be able to use on WNT the same font descriptor
|
||||
// string like on UNIX.
|
||||
// =====================================================================
|
||||
|
||||
// File Aspect_FontStyle.cxx
|
||||
// Created Septembre 1993
|
||||
// Author GG
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux Fontures de textes
|
||||
|
||||
//-Warning Un style est definie, soit par son type predefini TOF_...
|
||||
// soit par sa description (Font string de type ADOBE)
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
#define MAXFIELDS 14
|
||||
#define PITCHSIZE (0.00028 METER);
|
||||
|
||||
// for the class
|
||||
#include <Aspect_FontStyle.ixx>
|
||||
#include <Aspect_Units.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// MyFontType : TypeOfFont from Aspect;
|
||||
// MyStyle : AsciiString from TCollection
|
||||
// MyFontName : AsciiCString from TCollection
|
||||
// MyFontSize : Real from Standard
|
||||
// MyFontSlant : Real from Standard
|
||||
// MyCapsHeight : Boolean from Standard
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_FontStyle::Aspect_FontStyle () {
|
||||
|
||||
SetPredefinedStyle(Aspect_TOF_DEFAULT,0.003 METER,0.,Standard_False) ;
|
||||
}
|
||||
|
||||
Aspect_FontStyle::Aspect_FontStyle (const Aspect_TypeOfFont Type, const Quantity_Length Size, const Quantity_PlaneAngle Slant, const Standard_Boolean CapsHeight) {
|
||||
|
||||
SetPredefinedStyle(Type,Size,Slant,CapsHeight) ;
|
||||
}
|
||||
|
||||
Aspect_FontStyle::Aspect_FontStyle (const Standard_CString style, const Quantity_Length Size, const Quantity_PlaneAngle Slant, const Standard_Boolean CapsHeight) {
|
||||
|
||||
MyFontType = Aspect_TOF_USERDEFINED ;
|
||||
MyFontSize = Size;
|
||||
MyFontSlant = Slant;
|
||||
MyCapsHeight = CapsHeight;
|
||||
MyStyle = style;
|
||||
MyFontName = Normalize(style,MyFontSize) ;
|
||||
}
|
||||
|
||||
Aspect_FontStyle::Aspect_FontStyle (const Standard_CString style) {
|
||||
|
||||
MyFontType = Aspect_TOF_USERDEFINED ;
|
||||
MyFontSize = 0. ;
|
||||
MyFontSlant = 0. ;
|
||||
MyCapsHeight = Standard_False;
|
||||
MyStyle = style;
|
||||
MyFontName = Normalize(style,MyFontSize) ;
|
||||
}
|
||||
|
||||
Aspect_FontStyle& Aspect_FontStyle::Assign (const Aspect_FontStyle& Other) {
|
||||
|
||||
MyFontType = Other.Style() ;
|
||||
MyFontSize = Other.Size() ;
|
||||
MyFontSlant = Other.Slant() ;
|
||||
MyStyle = Other.Value();
|
||||
MyFontName = Other.FullName() ;
|
||||
MyCapsHeight = Other.CapsHeight() ;
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void Aspect_FontStyle::SetValues ( const Aspect_TypeOfFont Type, const Quantity_Length Size, const Quantity_PlaneAngle Slant, const Standard_Boolean CapsHeight) {
|
||||
|
||||
SetPredefinedStyle (Type,Size,Slant,CapsHeight);
|
||||
}
|
||||
|
||||
void Aspect_FontStyle::SetValues ( const Standard_CString style, const Quantity_Length Size, const Quantity_PlaneAngle Slant, const Standard_Boolean CapsHeight) {
|
||||
MyFontType = Aspect_TOF_USERDEFINED ;
|
||||
MyFontSize = Size;
|
||||
MyFontSlant = Slant;
|
||||
MyCapsHeight = CapsHeight;
|
||||
MyStyle = style;
|
||||
MyFontName = Normalize(style,MyFontSize) ;
|
||||
}
|
||||
|
||||
void Aspect_FontStyle::SetValues ( const Standard_CString style) {
|
||||
MyFontType = Aspect_TOF_USERDEFINED ;
|
||||
MyFontSize = 0. ;
|
||||
MyFontSlant = 0. ;
|
||||
MyCapsHeight = Standard_False;
|
||||
MyStyle = style;
|
||||
MyFontName = Normalize(style,MyFontSize) ;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Sets the family of the font.
|
||||
// ============================================================================
|
||||
|
||||
void Aspect_FontStyle::SetFamily(const Standard_CString aName) {
|
||||
MyFontName = SetField(MyFontName,aName,2);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Sets the weight of the font.
|
||||
// ============================================================================
|
||||
|
||||
void Aspect_FontStyle::SetWeight(const Standard_CString aName) {
|
||||
MyFontName = SetField(MyFontName,aName,3);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Sets the Registry of the font.
|
||||
// ============================================================================
|
||||
|
||||
void Aspect_FontStyle::SetRegistry(const Standard_CString aName) {
|
||||
MyFontName = SetField(MyFontName,aName,13);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Sets the Encoding of the font.
|
||||
// ============================================================================
|
||||
|
||||
void Aspect_FontStyle::SetEncoding(const Standard_CString aName) {
|
||||
MyFontName = SetField(MyFontName,aName,14);
|
||||
}
|
||||
|
||||
Aspect_TypeOfFont Aspect_FontStyle::Style () const {
|
||||
|
||||
return (MyFontType);
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_FontStyle::Length () const {
|
||||
|
||||
return MyStyle.Length();
|
||||
}
|
||||
|
||||
Standard_CString Aspect_FontStyle::Value () const
|
||||
{
|
||||
return MyStyle.ToCString();
|
||||
}
|
||||
|
||||
Quantity_Length Aspect_FontStyle::Size () const {
|
||||
return (MyFontSize);
|
||||
}
|
||||
|
||||
Quantity_PlaneAngle Aspect_FontStyle::Slant () const {
|
||||
|
||||
return (MyFontSlant);
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_FontStyle::CapsHeight () const {
|
||||
|
||||
return (MyCapsHeight);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the alias font name.
|
||||
// -- this is a shorter font name which identify the
|
||||
// -- main characteristics of the fonts.
|
||||
// ---Example: "helvetica-bold"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::AliasName() const
|
||||
{
|
||||
static TCollection_AsciiString aliasname;
|
||||
aliasname.Clear();
|
||||
TCollection_AsciiString family(Family());
|
||||
if( family.Length() > 0 && family != "*" ) {
|
||||
TCollection_AsciiString FAMILY = family; FAMILY.UpperCase();
|
||||
family.SetValue(1,FAMILY.Value(1));
|
||||
aliasname = family;
|
||||
}
|
||||
TCollection_AsciiString weight(Weight());
|
||||
if( weight.Length() > 0 && weight != "*" ) {
|
||||
TCollection_AsciiString WEIGHT = weight; WEIGHT.UpperCase();
|
||||
if( WEIGHT == "NORMAL" ) {
|
||||
weight.Clear();
|
||||
} else {
|
||||
weight.SetValue(1,WEIGHT.Value(1));
|
||||
}
|
||||
} else weight.Clear();
|
||||
TCollection_AsciiString sslant(SSlant());
|
||||
if( sslant.Length() > 0 && sslant != "*" ) {
|
||||
if( sslant == "r" ) {
|
||||
sslant.Clear();
|
||||
} else if( sslant == "i" ) {
|
||||
weight += "Italic";
|
||||
sslant.Clear();
|
||||
} else if( sslant == "o" ) {
|
||||
weight += "Oblique";
|
||||
sslant.Clear();
|
||||
}
|
||||
} else sslant.Clear();
|
||||
if( weight.Length() > 0 ) {
|
||||
aliasname += '-'; aliasname += weight;
|
||||
}
|
||||
if( sslant.Length() > 0 ) {
|
||||
aliasname += '-'; aliasname += sslant;
|
||||
}
|
||||
TCollection_AsciiString swidth(SWidth());
|
||||
if( swidth.Length() > 0 && swidth != "*" ) {
|
||||
TCollection_AsciiString SWIDTH = swidth; SWIDTH.UpperCase();
|
||||
if( SWIDTH == "NORMAL" ) {
|
||||
} else {
|
||||
if( !weight.Length() ) aliasname += '-';
|
||||
aliasname += '-'; aliasname += swidth;
|
||||
}
|
||||
}
|
||||
return aliasname.ToCString();
|
||||
}
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the full normalized font name
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::FullName () const {
|
||||
|
||||
return (MyFontName.ToCString());
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the foundry of the font.
|
||||
// ---Example: "adobe"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::Foundry() const
|
||||
{
|
||||
return Field(MyFontName,1);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the family of the font.
|
||||
// ---Example: "helvetica"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::Family() const
|
||||
{
|
||||
return Field(MyFontName,2);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the weight of the font.
|
||||
// ---Example: "bold"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::Weight() const
|
||||
{
|
||||
return Field(MyFontName,3);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the char set registry of the font.
|
||||
// ---Example: "iso8859"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::Registry() const
|
||||
{
|
||||
return Field(MyFontName,13);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the char set encoding of the font.
|
||||
// ---Example: "1"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::Encoding() const
|
||||
{
|
||||
return Field(MyFontName,14);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the slant of the font.
|
||||
// ---Example: "i"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::SSlant() const
|
||||
{
|
||||
return Field(MyFontName,4);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the width name of the font.
|
||||
// ---Example: "normal"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::SWidth() const
|
||||
{
|
||||
return Field(MyFontName,5);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the style name of the font.
|
||||
// ---Example: "serif"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::SStyle() const
|
||||
{
|
||||
return Field(MyFontName,6);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the pixel size of the font.
|
||||
// ---Example: "14"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::SPixelSize() const
|
||||
{
|
||||
return Field(MyFontName,7);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the point size of the font.
|
||||
// ---Example: "140"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::SPointSize() const
|
||||
{
|
||||
return Field(MyFontName,8);
|
||||
}
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the resolution X of the font.
|
||||
// ---Example: "75"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::SResolutionX() const
|
||||
{
|
||||
return Field(MyFontName,9);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the resolution Y of the font.
|
||||
// ---Example: "75"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::SResolutionY() const
|
||||
{
|
||||
return Field(MyFontName,10);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the spacing of the font.
|
||||
// ---Example: "p"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::SSpacing() const
|
||||
{
|
||||
return Field(MyFontName,11);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the average width of the font.
|
||||
// ---Example: "90"
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::SAverageWidth() const
|
||||
{
|
||||
return Field(MyFontName,12);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Dumps the font attributes.
|
||||
// ============================================================================
|
||||
|
||||
void Aspect_FontStyle::Dump() const
|
||||
{
|
||||
cout << ".Aspect_FontStyle::Dump() :" << endl;
|
||||
cout << "-----------------" << endl << endl;
|
||||
cout << " style name is : '" << this->Value() << "'" << endl;
|
||||
cout << " Normalized font name is : '" << this->FullName() << "'" << endl;
|
||||
cout << " Alias font name is : '" << this->AliasName() << "'" << endl;
|
||||
cout << " Foundry is : '" << this->Foundry() << "'" << endl;
|
||||
cout << " Family is : '" << this->Family() << "'" << endl;
|
||||
cout << " Weight is : '" << this->Weight() << "'" << endl;
|
||||
cout << " Slant is : '" << this->SSlant() << "'" << endl;
|
||||
cout << " Width is : '" << this->SWidth() << "'" << endl;
|
||||
cout << " Style is : '" << this->SStyle() << "'" << endl;
|
||||
cout << " PixelSize is : '" << this->SPixelSize() << "'" << endl;
|
||||
cout << " PointSize is : '" << this->SPointSize() << "'" << endl;
|
||||
cout << " ResolutionX is : '" << this->SResolutionX() << "'" << endl;
|
||||
cout << " ResolutionY is : '" << this->SResolutionY() << "'" << endl;
|
||||
cout << " Spacing is : '" << this->SSpacing() << "'" << endl;
|
||||
cout << " AverageWidth is : '" << this->SAverageWidth() << "'" << endl;
|
||||
cout << " Registry is : '" << this->Registry() << "'" << endl;
|
||||
cout << " Encoding is : '" << this->Encoding() << "'" << endl << endl;
|
||||
}
|
||||
|
||||
void Aspect_FontStyle::SetPredefinedStyle( const Aspect_TypeOfFont Type, const Quantity_Length Size, const Quantity_PlaneAngle Slant, const Standard_Boolean CapsHeight) {
|
||||
|
||||
if( Size <= 0. )
|
||||
Aspect_FontStyleDefinitionError::Raise ("Bad font Size");
|
||||
|
||||
MyFontType = Type ;
|
||||
MyFontSize = Size;
|
||||
MyFontSlant = Slant ;
|
||||
MyCapsHeight = CapsHeight;
|
||||
Standard_CString pstyle = "" ;
|
||||
switch ( Type ) {
|
||||
case Aspect_TOF_USERDEFINED :
|
||||
Aspect_FontStyleDefinitionError::Raise ("Bad Font Type Style");
|
||||
case Aspect_TOF_DEFAULT :
|
||||
pstyle = "Defaultfont" ;
|
||||
break ;
|
||||
case Aspect_TOF_COURIER :
|
||||
pstyle = "Courier" ;
|
||||
break ;
|
||||
case Aspect_TOF_HELVETICA :
|
||||
pstyle = "Helvetica" ;
|
||||
break ;
|
||||
case Aspect_TOF_TIMES :
|
||||
pstyle = "Times" ;
|
||||
break ;
|
||||
}
|
||||
MyStyle = pstyle;
|
||||
MyFontName = Normalize(pstyle,MyFontSize);
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_FontStyle::IsEqual(const Aspect_FontStyle& Other) const
|
||||
{
|
||||
return (
|
||||
(MyFontType == Other.MyFontType) &&
|
||||
(MyFontName.Length() == Other.MyFontName.Length()) &&
|
||||
(MyFontName == Other.MyFontName) &&
|
||||
(MyFontSize == Other.MyFontSize) &&
|
||||
(MyFontSlant == Other.MyFontSlant) &&
|
||||
(MyCapsHeight == Other.MyCapsHeight)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_FontStyle::IsNotEqual(const Aspect_FontStyle& Other) const
|
||||
{
|
||||
return !IsEqual(Other);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns a normalized XLFD descriptor from the font name
|
||||
// -- <aFontName>
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::Normalize(const Standard_CString aFontName,Standard_Real& aSize)
|
||||
{
|
||||
Aspect_FontStyleDefinitionError_Raise_if(
|
||||
!aFontName ,"NULL font descriptor");
|
||||
|
||||
static TCollection_AsciiString afontstring;
|
||||
static TCollection_AsciiString astar("*");
|
||||
static TCollection_AsciiString azero("0");
|
||||
TCollection_AsciiString afield,afontname(aFontName);
|
||||
Standard_CString pfontname = NULL;
|
||||
Standard_Boolean xlfd = Standard_False;
|
||||
Standard_Integer i,len = afontname.Length();
|
||||
|
||||
afontstring = "";
|
||||
|
||||
if( len <= 0 ) return pfontname;
|
||||
|
||||
if( afontname.Value(1) != '-' ) afontname.Prepend("-adobe-");
|
||||
for( i=1 ; i<=MAXFIELDS ; i++ ) {
|
||||
Standard_CString pfield = Field(afontname,i);
|
||||
switch (i) {
|
||||
case 1:
|
||||
if( pfield ) {
|
||||
afield = pfield; afield.LowerCase();
|
||||
{afontstring += '-'; afontstring += afield;}
|
||||
} else {
|
||||
afontstring += "-adobe";
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if( pfield ) {
|
||||
afield = pfield; afield.LowerCase();
|
||||
if( afield == astar ) {
|
||||
if( aSize > 0. ) afontstring += "-*";
|
||||
else {afontstring += "-0"; xlfd = Standard_True;}
|
||||
} else if( afield == azero ) { afontstring += "-0"; xlfd = Standard_True;}
|
||||
else {afontstring += '-'; afontstring += afield;}
|
||||
} else {
|
||||
if( aSize > 0. ) afontstring += "-*";
|
||||
else { afontstring += "-0"; xlfd = Standard_True;}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
if( xlfd ) {
|
||||
afontstring += "-0";
|
||||
} else if( pfield ) {
|
||||
afield = pfield; afield.LowerCase();
|
||||
afontstring += '-'; afontstring += afield;
|
||||
} else {
|
||||
afontstring += "-*";
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
if( pfield ) {
|
||||
afield = pfield; afield.LowerCase();
|
||||
afontstring += '-'; afontstring += afield;
|
||||
} else {
|
||||
afontstring += "-*";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if( pfield ) {
|
||||
afield = pfield;
|
||||
afontstring += '-'; afontstring += afield;
|
||||
} else {
|
||||
afontstring += "-*";
|
||||
}
|
||||
}
|
||||
}
|
||||
pfontname = afontstring.ToCString();
|
||||
if( aSize == 0. ) {
|
||||
Standard_CString psize = Field(pfontname,7);
|
||||
Standard_Integer isize;
|
||||
if( sscanf(psize,"%d",&isize) == 1 ) {
|
||||
aSize = isize*PITCHSIZE;
|
||||
} else {
|
||||
aSize = 2. MILLIMETER;
|
||||
}
|
||||
}
|
||||
|
||||
return pfontname;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Returns the field at position <aRank>
|
||||
// -- from the font name <aFontName>.
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::Field(const TCollection_AsciiString& aFontName,const Standard_Integer aRank)
|
||||
{
|
||||
static TCollection_AsciiString afieldstring;
|
||||
Standard_Integer length = aFontName.Length();
|
||||
Standard_CString pfield = NULL;
|
||||
|
||||
if( length > 0 && aRank >= 1 && aRank <= MAXFIELDS ) {
|
||||
Standard_Integer start = 1,end = 0;
|
||||
start = aFontName.Location(aRank,'-',1,length);
|
||||
end = aFontName.Location(aRank+1,'-',1,length);
|
||||
afieldstring = "";
|
||||
if( start > 0 && end > 0 ) {
|
||||
start++ ;
|
||||
end--;
|
||||
if( end >= start ) afieldstring = aFontName.SubString(start,end);
|
||||
else afieldstring = "";
|
||||
} else if( start > 0 ) {
|
||||
start++ ;
|
||||
end = length;
|
||||
if( end >= start ) afieldstring = aFontName.SubString(start,end);
|
||||
else afieldstring = "";
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
pfield = afieldstring.ToCString();
|
||||
|
||||
return pfield;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ---Purpose: Sets the field at position <aRank>
|
||||
// -- of the font <aFontName>
|
||||
// -- from the field <aField>.
|
||||
// ============================================================================
|
||||
|
||||
Standard_CString Aspect_FontStyle::SetField(const TCollection_AsciiString& aFontName,const Standard_CString aField,const Standard_Integer aRank)
|
||||
{
|
||||
static TCollection_AsciiString afontstring;
|
||||
Standard_Integer length = aFontName.Length();
|
||||
Standard_CString pfontname = NULL;
|
||||
|
||||
if( length > 0 && aRank >= 1 && aRank <= MAXFIELDS ) {
|
||||
Standard_Integer start = 1,end = 0;
|
||||
start = aFontName.Location(aRank,'-',1,length);
|
||||
end = aFontName.Location(aRank+1,'-',1,length);
|
||||
TCollection_AsciiString lowername(""),uppername("");
|
||||
if( start > 0 && end > 0 ) {
|
||||
if( end > start ) {
|
||||
if( start > 1 ) lowername = aFontName.SubString(1,start);
|
||||
uppername = aFontName.SubString(end,length);
|
||||
}
|
||||
} else if( start > 1 ) {
|
||||
lowername = aFontName.SubString(1,start);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
afontstring = lowername;
|
||||
afontstring += aField; afontstring += uppername;
|
||||
pfontname = afontstring.ToCString();
|
||||
}
|
||||
|
||||
return pfontname;
|
||||
}
|
120
src/Aspect/Aspect_GenId.cdl
Executable file
120
src/Aspect/Aspect_GenId.cdl
Executable file
@@ -0,0 +1,120 @@
|
||||
--
|
||||
-- File: Aspect_GenId.cdl
|
||||
-- Created: Mercredi 13 Mai 1992
|
||||
-- Author: NW,JPB,CAL
|
||||
--
|
||||
---Copyright: MatraDatavision 1991,1992,1993
|
||||
--
|
||||
|
||||
class GenId from Aspect
|
||||
|
||||
---Version:
|
||||
|
||||
---Level: Internal
|
||||
---Purpose: This class permits the creation and control of all
|
||||
-- identifiers.
|
||||
-- Warning: An identifier is an integer.
|
||||
|
||||
---References:
|
||||
|
||||
uses
|
||||
|
||||
ListOfInteger from TColStd
|
||||
|
||||
raises
|
||||
|
||||
IdentDefinitionError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns GenId from Aspect;
|
||||
---Level: Internal
|
||||
---Purpose: Creates an available set of identifiers with the lower
|
||||
-- bound 0 and the upper bound INT_MAX/2.
|
||||
|
||||
Create ( Low, Up : Integer from Standard )
|
||||
returns GenId from Aspect
|
||||
---Level: Internal
|
||||
---Purpose: Creates an available set of identifiers with the lower
|
||||
-- bound <Low> and the upper bound <Up>.
|
||||
-- Warning: Raises IdentDefinitionError if <Up> is less than <Low>.
|
||||
raises IdentDefinitionError from Aspect;
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
--Assign ( me : in out;
|
||||
--Other : GenId from Aspect );
|
||||
---Level: Internal
|
||||
---Purpose: Copies the content of <Other> into <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
-- C++: alias operator =
|
||||
|
||||
Free ( me : in out );
|
||||
---Level: Internal
|
||||
---Purpose: Frees all identifiers of <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
Free ( me : in out;
|
||||
Id : Integer from Standard );
|
||||
---Level: Internal
|
||||
---Purpose: Frees the identifier <Id> of <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
Available ( me )
|
||||
returns Integer from Standard;
|
||||
---Level: Internal
|
||||
---Purpose: Returns the number of available identifiers of <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
Lower ( me )
|
||||
returns Integer from Standard;
|
||||
---Level: Internal
|
||||
---Purpose: Returns the lower bound of <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
Next ( me : in out )
|
||||
returns Integer from Standard
|
||||
---Level: Internal
|
||||
---Purpose: Returns an available identifier of <me>.
|
||||
-- Warning: Raises IdentDefinitionError if all identifiers are busy.
|
||||
raises IdentDefinitionError from Aspect;
|
||||
|
||||
Upper ( me )
|
||||
returns Integer from Standard;
|
||||
---Level: Internal
|
||||
---Purpose: Returns the upper bound of <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
--
|
||||
-- Class : Aspect_GenId
|
||||
--
|
||||
-- Purpose : Declaration of variables specific to identifiers
|
||||
--
|
||||
-- Reminder : An identifier is an integer
|
||||
--
|
||||
|
||||
-- the current number of available identifiers
|
||||
MyCount : Integer from Standard;
|
||||
|
||||
-- the number of identifiers
|
||||
MyLength : Integer from Standard;
|
||||
|
||||
-- the limits for identifiers
|
||||
MyLowerBound : Integer from Standard;
|
||||
MyUpperBound : Integer from Standard;
|
||||
|
||||
-- to save free identifiers
|
||||
MyFreeIds : ListOfInteger from TColStd;
|
||||
|
||||
end GenId;
|
115
src/Aspect/Aspect_GenId.cxx
Executable file
115
src/Aspect/Aspect_GenId.cxx
Executable file
@@ -0,0 +1,115 @@
|
||||
|
||||
// File Aspect_GenId.cxx
|
||||
// Created Mai 1992
|
||||
// Author NW,JPB,CAL
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux identificateurs
|
||||
|
||||
//-Warning Un identificateur est un entier.
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_GenId.ixx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_GenId::Aspect_GenId ():
|
||||
|
||||
MyCount (INT_MAX/2 + 1),
|
||||
MyLength (INT_MAX/2 + 1),
|
||||
MyLowerBound (0),
|
||||
MyUpperBound (INT_MAX/2),
|
||||
MyFreeIds () {
|
||||
|
||||
}
|
||||
|
||||
Aspect_GenId::Aspect_GenId (const Standard_Integer Low, const Standard_Integer Up):MyFreeIds () {
|
||||
|
||||
if (Low <= Up) {
|
||||
MyLowerBound = Low;
|
||||
MyUpperBound = Up;
|
||||
MyLength = MyUpperBound - MyLowerBound + 1;
|
||||
MyCount = MyLength;
|
||||
}
|
||||
else
|
||||
Aspect_IdentDefinitionError::Raise
|
||||
("GenId Create Error: Low > Up");
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_GenId::Available () const {
|
||||
|
||||
return (MyCount);
|
||||
|
||||
}
|
||||
|
||||
void Aspect_GenId::Free () {
|
||||
|
||||
MyCount = MyLength;
|
||||
MyFreeIds.Clear ();
|
||||
|
||||
}
|
||||
|
||||
void Aspect_GenId::Free (const Standard_Integer Id) {
|
||||
|
||||
if ( (Id >= MyLowerBound) && (Id <= MyUpperBound) )
|
||||
MyFreeIds.Prepend (Id);
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_GenId::Lower () const {
|
||||
|
||||
return (MyLowerBound);
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_GenId::Next () {
|
||||
|
||||
if (MyCount == 0)
|
||||
Aspect_IdentDefinitionError::Raise
|
||||
("GenId Next Error: Available == 0");
|
||||
|
||||
Standard_Integer Id;
|
||||
|
||||
if (! MyFreeIds.IsEmpty ()) {
|
||||
Id = MyFreeIds.First ();
|
||||
MyFreeIds.RemoveFirst ();
|
||||
}
|
||||
else {
|
||||
MyCount --;
|
||||
Id = MyLowerBound + MyLength - MyCount - 1;
|
||||
}
|
||||
|
||||
return Id;
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_GenId::Upper () const {
|
||||
|
||||
return (MyUpperBound);
|
||||
|
||||
}
|
||||
|
||||
//void Aspect_GenId::Assign (const Aspect_GenId& Other) {
|
||||
//
|
||||
// MyLowerBound = Other.Lower ();
|
||||
// MyUpperBound = Other.Upper ();
|
||||
//
|
||||
//}
|
92
src/Aspect/Aspect_GenericColorMap.cdl
Executable file
92
src/Aspect/Aspect_GenericColorMap.cdl
Executable file
@@ -0,0 +1,92 @@
|
||||
--
|
||||
-- File: Aspect_GenericColorMap.cdl
|
||||
-- Created: 23/03/93
|
||||
-- Author: BBL
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
class GenericColorMap from Aspect inherits ColorMap from Aspect
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Level: Public
|
||||
---Purpose: This class defines a GenericColorMap object.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
Color from Quantity,
|
||||
TypeOfColorMap from Aspect,
|
||||
ColorMapEntry from Aspect,
|
||||
DataMapOfIntegerInteger from TColStd
|
||||
|
||||
raises
|
||||
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns mutable GenericColorMap from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates a generic ColorMap .
|
||||
|
||||
AddEntry (me : mutable; AnEntry : ColorMapEntry from Aspect)
|
||||
---Level: Public
|
||||
---Purpose: Adds an entry in the color map <me>.
|
||||
-- Warning: Raises BadAccess if the ColorMapEntry index is alreadry
|
||||
-- defined.
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
AddEntry (me : mutable; aColor : Color from Quantity)
|
||||
returns Integer from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Search an identical color entry in the color map <me>
|
||||
-- and returns the ColorMapEntry Index if exist.
|
||||
-- Or add a new entry and returns the computed ColorMapEntry index used.
|
||||
RemoveEntry ( me: mutable;
|
||||
AColorMapEntryIndex : Integer from Standard )
|
||||
raises BadAccess from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Remove the ColorMapEntry at position index in the ColorMap
|
||||
-- Warning: Raises BadAccess if the index is not defined in the
|
||||
-- ColorMap.
|
||||
|
||||
FindColorMapIndex ( me ; AColorMapEntryIndex : Integer from Standard )
|
||||
returns Integer from Standard
|
||||
raises BadAccess from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the index in the ColorMap of the
|
||||
-- ColorMapEntry.Index() equal to <AnEntryIndex>.
|
||||
-- Warning: Raises BadAccess if the index is not defined in the
|
||||
-- ColorMap.
|
||||
|
||||
FindEntry ( me ; AColorMapEntryIndex : Integer from Standard )
|
||||
returns ColorMapEntry from Aspect
|
||||
raises BadAccess from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the ColorMapEntry with ColorMapEntry.Index()
|
||||
-- equal to <AnEntryIndex>.
|
||||
-- Warning: Raises BadAccess if the index is not defined in the
|
||||
-- ColorMap.
|
||||
---C++: return const &
|
||||
|
||||
NearestColorMapIndex( me ; aColor : Color from Quantity )
|
||||
returns Integer from Standard ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the index in the ColorMap of the
|
||||
-- nearest matching ColorMapEntry
|
||||
|
||||
NearestEntry( me ; aColor : Color from Quantity )
|
||||
returns ColorMapEntry from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the nearest ColorMapEntry that match aColor .
|
||||
---C++: return const &
|
||||
|
||||
fields
|
||||
|
||||
myDataMap : DataMapOfIntegerInteger from TColStd is protected;
|
||||
|
||||
end GenericColorMap;
|
124
src/Aspect/Aspect_GenericColorMap.cxx
Executable file
124
src/Aspect/Aspect_GenericColorMap.cxx
Executable file
@@ -0,0 +1,124 @@
|
||||
#define IMP080300 //GG Add protection on FindColorMapIndex()
|
||||
|
||||
#define IMP060400 //GG Take in account the Hue of the color
|
||||
// for computing the nearest color index.
|
||||
|
||||
#include <Aspect_GenericColorMap.ixx>
|
||||
#include <Aspect_ColorMapEntry.hxx>
|
||||
|
||||
Aspect_GenericColorMap::Aspect_GenericColorMap ():Aspect_ColorMap (Aspect_TOC_Generic) {
|
||||
Aspect_ColorMapEntry theDefaultEntry;
|
||||
|
||||
AddEntry(theDefaultEntry);
|
||||
}
|
||||
|
||||
void Aspect_GenericColorMap::AddEntry (const Aspect_ColorMapEntry& AnEntry) {
|
||||
Standard_Integer index = AnEntry.Index();
|
||||
|
||||
if ( myDataMap.IsBound( index ) ) {
|
||||
Standard_Integer i = myDataMap( index ) ;
|
||||
mydata.SetValue( i , AnEntry ) ;
|
||||
} else {
|
||||
mydata.Append( AnEntry ) ;
|
||||
myDataMap.Bind( index , mydata.Length() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_GenericColorMap::AddEntry (const Quantity_Color &aColor) {
|
||||
Aspect_ColorMapEntry theEntry ;
|
||||
Standard_Integer i,maxindex = 0 ;
|
||||
|
||||
for( i=1 ; i<=mydata.Length() ; i++ ) {
|
||||
theEntry = mydata.Value(i) ;
|
||||
maxindex = Max(maxindex,theEntry.Index()) ;
|
||||
if( theEntry.Color() == aColor ) return theEntry.Index() ;
|
||||
}
|
||||
|
||||
maxindex++ ;
|
||||
theEntry.SetValue(maxindex,aColor) ;
|
||||
mydata.Append( theEntry ) ;
|
||||
myDataMap.Bind( maxindex , mydata.Length() ) ;
|
||||
return maxindex ;
|
||||
}
|
||||
|
||||
void Aspect_GenericColorMap::RemoveEntry (const Standard_Integer index) {
|
||||
|
||||
mydata.Remove( index ) ;
|
||||
}
|
||||
|
||||
const Aspect_ColorMapEntry& Aspect_GenericColorMap::NearestEntry(
|
||||
const Quantity_Color& color ) const
|
||||
|
||||
{
|
||||
return( Entry( NearestColorMapIndex( color ) ) ) ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_GenericColorMap::NearestColorMapIndex(
|
||||
const Quantity_Color& color ) const
|
||||
|
||||
{
|
||||
|
||||
Standard_Real dist ;
|
||||
struct {
|
||||
Standard_Real dist ;
|
||||
Standard_Integer index ;
|
||||
} nearest;
|
||||
|
||||
nearest.dist = 0. ;
|
||||
nearest.index = 0 ;
|
||||
|
||||
#ifdef IMP060400
|
||||
Standard_Integer ehue,hue = (color.Hue() < 0.) ? -1 :
|
||||
Standard_Integer(color.Hue())/60;
|
||||
#endif
|
||||
|
||||
Quantity_Color ecolor;
|
||||
|
||||
if ( Size() == 0 )
|
||||
Aspect_BadAccess::Raise ("NearestColorMapIndex() ColorMap is empty.");
|
||||
|
||||
for ( Standard_Integer i = 1 ; i <= Size() ; i++ ) {
|
||||
if ( Entry(i).IsAllocated() ) {
|
||||
ecolor = Entry(i).Color();
|
||||
dist = color.SquareDistance( ecolor ) ;
|
||||
#ifdef IMP060400
|
||||
ehue = (ecolor.Hue() < 0.) ? -1 : Standard_Integer(ecolor.Hue())/60;
|
||||
if ( (nearest.index == 0) ||
|
||||
((dist < nearest.dist) && (hue == ehue)) ) {
|
||||
#else
|
||||
if ( nearest.index == 0 || dist < nearest.dist ) {
|
||||
#endif
|
||||
nearest.index = i ;
|
||||
nearest.dist = dist ;
|
||||
#ifdef IMP060400
|
||||
if( dist == 0.0 ) break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( nearest.index == 0 )
|
||||
Aspect_BadAccess::Raise ("NearestEntryIndex() ColorMap is empty.");
|
||||
|
||||
return( nearest.index ) ;
|
||||
}
|
||||
|
||||
const Aspect_ColorMapEntry& Aspect_GenericColorMap::FindEntry(
|
||||
const Standard_Integer ColorEntryIndex ) const
|
||||
|
||||
{
|
||||
return( Entry( FindColorMapIndex( ColorEntryIndex ) ) ) ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_GenericColorMap::FindColorMapIndex(
|
||||
const Standard_Integer ColorEntryIndex ) const
|
||||
{
|
||||
Standard_Integer index = 0;
|
||||
#ifdef IMP080300
|
||||
if( myDataMap.IsBound( ColorEntryIndex ) )
|
||||
index = myDataMap.Find( ColorEntryIndex );
|
||||
#else
|
||||
index = myDataMap ( ColorEntryIndex );
|
||||
#endif
|
||||
return index;
|
||||
}
|
85
src/Aspect/Aspect_GradientBackground.cdl
Executable file
85
src/Aspect/Aspect_GradientBackground.cdl
Executable file
@@ -0,0 +1,85 @@
|
||||
--
|
||||
-- File: Aspect_GradientBackground.cdl
|
||||
-- Created: 21 May 2010
|
||||
-- Author: PAUL SUPRYATKIN
|
||||
--
|
||||
---Copyright: Open CASCADE 2010
|
||||
--
|
||||
|
||||
class GradientBackground from Aspect
|
||||
inherits Background from Aspect
|
||||
|
||||
|
||||
---Purpose: This class allows the definition of
|
||||
-- a window gradient background.
|
||||
|
||||
uses
|
||||
|
||||
Color from Quantity,
|
||||
GradientFillMethod from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns GradientBackground from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates a window gradient background.
|
||||
-- Default colors : Quantity_NOC_BLACK.
|
||||
-- Default fill method : Aspect_GFM_NONE
|
||||
|
||||
Create ( AColor1 : Color from Quantity;
|
||||
AColor2 : Color from Quantity;
|
||||
AMethod : GradientFillMethod from Aspect = Aspect_GFM_HOR)
|
||||
returns GradientBackground from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates a window gradient background with colours <AColor1, AColor2>.
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
SetColors ( me : in out;
|
||||
AColor1 : Color from Quantity ;
|
||||
AColor2 : Color from Quantity ;
|
||||
AMethod : GradientFillMethod from Aspect = Aspect_GFM_HOR
|
||||
);
|
||||
---Level: Public
|
||||
---Purpose: Modifies the colours of the window gradient background <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBgGradientFillMethod( me ;
|
||||
AMethod : GradientFillMethod from Aspect = Aspect_GFM_NONE);
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
Colors ( me;
|
||||
AColor1 : out Color from Quantity;
|
||||
AColor2 : out Color from Quantity
|
||||
);
|
||||
---Level: Public
|
||||
---Purpose: Returns colours of the window gradient background <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
BgGradientFillMethod( me ) returns GradientFillMethod from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns the current gradient background fill mode.
|
||||
|
||||
|
||||
fields
|
||||
|
||||
--
|
||||
-- Class : Aspect_GradientBackground
|
||||
--
|
||||
-- Purpose : Declaration of variables specific to the window
|
||||
-- gradient background.
|
||||
--
|
||||
-- Reminder : A Gradient background is defined by two colours
|
||||
--
|
||||
|
||||
-- the colour associated with the window background
|
||||
MyColor2 : Color from Quantity;
|
||||
MyGradientMethod : GradientFillMethod from Aspect;
|
||||
|
||||
end GradientBackground ;
|
51
src/Aspect/Aspect_GradientBackground.cxx
Executable file
51
src/Aspect/Aspect_GradientBackground.cxx
Executable file
@@ -0,0 +1,51 @@
|
||||
// File: Aspect_GradientBackground.cdl
|
||||
// Created: 21 May 2010
|
||||
// Author: PAUL SUPRYATKIN
|
||||
|
||||
//Copyright: Open CASCADE 2010
|
||||
|
||||
|
||||
|
||||
#include <Aspect_GradientBackground.hxx>
|
||||
|
||||
|
||||
Aspect_GradientBackground::Aspect_GradientBackground () {
|
||||
|
||||
Quantity_Color Black (Quantity_NOC_BLACK);
|
||||
|
||||
SetColor( Black );
|
||||
MyColor2 = Black;
|
||||
MyGradientMethod = Aspect_GFM_NONE;
|
||||
|
||||
}
|
||||
|
||||
Aspect_GradientBackground::Aspect_GradientBackground( const Quantity_Color& AColor1,
|
||||
const Quantity_Color& AColor2,
|
||||
const Aspect_GradientFillMethod AMethod )
|
||||
{
|
||||
SetColor( AColor1 );
|
||||
MyColor2 = AColor2;
|
||||
MyGradientMethod = AMethod;
|
||||
};
|
||||
|
||||
|
||||
void Aspect_GradientBackground::SetColors( const Quantity_Color& AColor1,
|
||||
const Quantity_Color& AColor2,
|
||||
const Aspect_GradientFillMethod AMethod )
|
||||
{
|
||||
SetColor( AColor1 );
|
||||
MyColor2 = AColor2;
|
||||
MyGradientMethod = AMethod;
|
||||
}
|
||||
|
||||
void Aspect_GradientBackground::Colors ( Quantity_Color& AColor1, Quantity_Color& AColor2) const
|
||||
{
|
||||
AColor1 = Color();
|
||||
AColor2 = MyColor2;
|
||||
}
|
||||
|
||||
Aspect_GradientFillMethod Aspect_GradientBackground::BgGradientFillMethod( ) const
|
||||
{
|
||||
return MyGradientMethod;
|
||||
}
|
||||
|
50
src/Aspect/Aspect_GraphicCallbackProc.hxx
Executable file
50
src/Aspect/Aspect_GraphicCallbackProc.hxx
Executable file
@@ -0,0 +1,50 @@
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Aspect_GraphicCallbackProc.hxx */
|
||||
/*==== Role : The header file of primitive type "GraphicCallbackProc" from package */
|
||||
/*==== "V3d" */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
/*============================================================================*/
|
||||
|
||||
#ifndef _Aspect_GraphicCallbackProc_HeaderFile
|
||||
#define _Aspect_GraphicCallbackProc_HeaderFile
|
||||
#include <Aspect_Display.hxx>
|
||||
#include <Aspect_Drawable.hxx>
|
||||
#include <Aspect_RenderingContext.hxx>
|
||||
|
||||
#define OCC_REDRAW_WINDOW 1
|
||||
#define OCC_REDRAW_WINDOWAREA 2
|
||||
#define OCC_REDRAW_BITMAP 3
|
||||
|
||||
/*
|
||||
This flag, when bitwise OR`ed with the "reason" value,
|
||||
informs the callback that it is called before redrawing the overlayer .
|
||||
Otherwise, the callback is invoked after the overlayer is redrawn.
|
||||
*/
|
||||
#define OCC_PRE_OVERLAY 0x8000
|
||||
|
||||
typedef struct {
|
||||
int reason;
|
||||
int wsID;
|
||||
int viewID;
|
||||
Aspect_Display display;
|
||||
Aspect_Drawable window;
|
||||
Aspect_RenderingContext gcontext;
|
||||
} Aspect_GraphicCallbackStruct;
|
||||
|
||||
typedef int (*Aspect_GraphicCallbackProc)(
|
||||
Aspect_Drawable /* Window ID */,
|
||||
void* /* user data */,
|
||||
Aspect_GraphicCallbackStruct* /* call data */
|
||||
);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
/*==== Definition de Type ====================================================*/
|
||||
|
||||
#include <Standard_Macro.hxx>
|
||||
class Handle(Standard_Type);
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_GraphicCallbackProc);
|
||||
|
||||
/*============================================================================*/
|
||||
#endif
|
||||
|
||||
#endif /* _Aspect_GraphicCallbackProc_HeaderFile */
|
27
src/Aspect/Aspect_GraphicDevice.cdl
Executable file
27
src/Aspect/Aspect_GraphicDevice.cdl
Executable file
@@ -0,0 +1,27 @@
|
||||
|
||||
-- File: Aspect_GraphicDevice.cdl
|
||||
-- Created: Tue Oct 19 09:19:10 1993
|
||||
-- Author: Jean-Louis FRENKEL
|
||||
-- <jlf@stylox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
deferred class GraphicDevice from Aspect inherits TShared from MMgt
|
||||
|
||||
uses
|
||||
|
||||
GraphicDriver from Aspect
|
||||
|
||||
raises
|
||||
|
||||
GraphicDeviceDefinitionError from Aspect,
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
|
||||
Initialize;
|
||||
|
||||
GraphicDriver ( me )
|
||||
returns GraphicDriver from Aspect
|
||||
is deferred;
|
||||
|
||||
end GraphicDevice from Aspect;
|
9
src/Aspect/Aspect_GraphicDevice.cxx
Executable file
9
src/Aspect/Aspect_GraphicDevice.cxx
Executable file
@@ -0,0 +1,9 @@
|
||||
|
||||
// File: Aspect_GraphicDevice.cxx
|
||||
// Created: Tue Oct 19 09:22:56 1993
|
||||
// Author: Stephane CALLEGARI
|
||||
// <cal@stylox>
|
||||
|
||||
#include <Aspect_GraphicDevice.ixx>
|
||||
|
||||
Aspect_GraphicDevice::Aspect_GraphicDevice () {}
|
15
src/Aspect/Aspect_GraphicDriver.cdl
Executable file
15
src/Aspect/Aspect_GraphicDriver.cdl
Executable file
@@ -0,0 +1,15 @@
|
||||
--
|
||||
-- File: Aspect_GraphicDriver.cdl
|
||||
-- Created: Mardi 28 janvier 1997
|
||||
-- Author: CAL
|
||||
--
|
||||
---Copyright: MatraDatavision 1997
|
||||
--
|
||||
|
||||
deferred class GraphicDriver from Aspect inherits TShared
|
||||
|
||||
is
|
||||
|
||||
Initialize;
|
||||
|
||||
end GraphicDriver from Aspect;
|
11
src/Aspect/Aspect_GraphicDriver.cxx
Executable file
11
src/Aspect/Aspect_GraphicDriver.cxx
Executable file
@@ -0,0 +1,11 @@
|
||||
|
||||
// File Aspect_GraphicDriver.cxx
|
||||
// Created Mardi 28 janvier 1997
|
||||
// Author CAL
|
||||
|
||||
//-Copyright MatraDatavision 1997
|
||||
|
||||
#include <Aspect_GraphicDriver.ixx>
|
||||
|
||||
Aspect_GraphicDriver::Aspect_GraphicDriver () {
|
||||
}
|
167
src/Aspect/Aspect_Grid.cdl
Executable file
167
src/Aspect/Aspect_Grid.cdl
Executable file
@@ -0,0 +1,167 @@
|
||||
-- File: Aspect_Grid.cdl
|
||||
-- Created: Thu Mar 2 14:23:42 1995
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@pernox>
|
||||
-- Updated: GG IMP230300 Add grid color parameters in constructor
|
||||
-- and add new methods SetColors() & Colors()
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
deferred class Grid from Aspect
|
||||
inherits TShared from MMgt
|
||||
|
||||
uses
|
||||
PlaneAngle, Length from Quantity,
|
||||
GridDrawMode from Aspect,
|
||||
Color from Quantity
|
||||
is
|
||||
|
||||
Initialize(anXOrigin: Length from Quantity = 0.0;
|
||||
anYOrigin: Length from Quantity = 0.0;
|
||||
aRotationAngle: PlaneAngle from Quantity = 0;
|
||||
aColor: Color from Quantity = Quantity_NOC_GRAY50;
|
||||
aTenthColor: Color from Quantity = Quantity_NOC_GRAY70);
|
||||
|
||||
---Purpose: creates a new grid. By default this grid is not
|
||||
-- active.
|
||||
|
||||
---Category: grid definition methods
|
||||
|
||||
SetXOrigin(me: mutable; anOrigin: Length from Quantity)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: defines the x Origin of the grid.
|
||||
|
||||
SetYOrigin(me: mutable; anOrigin: Length from Quantity)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: defines the y Origin of the grid.
|
||||
|
||||
SetRotationAngle(me: mutable; anAngle: PlaneAngle from Quantity)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: defines the orientation of the the grid.
|
||||
|
||||
Rotate(me: mutable; anAngle: PlaneAngle from Quantity)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Rotate the grid from a relative angle.
|
||||
|
||||
Translate(me: mutable; aDx, aDy: Length from Quantity)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Translate the grid from a relative distance.
|
||||
|
||||
SetColors ( me : mutable;
|
||||
aColor : Color from Quantity;
|
||||
aTenthColor : Color from Quantity )
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Change the colors of the grid
|
||||
|
||||
---Category: Pick methods
|
||||
--
|
||||
Hit(me; X,Y: Length from Quantity; gridX, gridY : out Length from Quantity)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: returns the point of the grid the closest to the point X,Y
|
||||
-- if the grid is active. If the grid is not active returns
|
||||
-- X,Y.
|
||||
|
||||
Compute(me; X,Y: Length from Quantity; gridX, gridY : out Length from Quantity)
|
||||
is deferred;
|
||||
---Level: Internal
|
||||
---Purpose: returns the point of the grid the closest to the point X,Y
|
||||
---Category: Managment methods.
|
||||
|
||||
Activate(me: mutable)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: activates the grid. The Hit method will return
|
||||
-- gridx and gridx computed according to the steps
|
||||
-- of the grid.
|
||||
|
||||
Deactivate(me: mutable)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: deactivates the grid. The hit method will return
|
||||
-- gridx and gridx as the enter value X & Y.
|
||||
|
||||
---Category: inquire methods
|
||||
|
||||
XOrigin(me) returns Length from Quantity
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: returns the x Origin of the grid.
|
||||
|
||||
YOrigin(me) returns Length from Quantity
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: returns the x Origin of the grid.
|
||||
|
||||
|
||||
RotationAngle(me) returns PlaneAngle from Quantity
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: returns the x Angle of the grid.
|
||||
|
||||
|
||||
IsActive(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns TRUE when the grid is active.
|
||||
|
||||
Colors(me ; aColor,aTenthColor: out Color from Quantity)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the colors of the grid.
|
||||
|
||||
---Category: display methods
|
||||
|
||||
SetDrawMode(me: mutable; aDrawMode: GridDrawMode from Aspect)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Change the grid aspect.
|
||||
|
||||
DrawMode(me) returns GridDrawMode from Aspect
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the grid aspect.
|
||||
|
||||
Display(me: mutable)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Display the grid at screen.
|
||||
|
||||
Erase(me)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Erase the grid from screen.
|
||||
|
||||
IsDisplayed(me)
|
||||
returns Boolean from Standard
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns TRUE when the grid is displayed at screen.
|
||||
|
||||
UpdateDisplay(me: mutable)
|
||||
is virtual protected;
|
||||
---Level: Internal
|
||||
---Purpose: Updates the grid parameters.
|
||||
|
||||
Init(me: mutable)
|
||||
is deferred;
|
||||
---Level: Internal
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myRotationAngle: PlaneAngle from Quantity is protected;
|
||||
myXOrigin: Length from Quantity is protected;
|
||||
myYOrigin: Length from Quantity is protected;
|
||||
myColor: Color from Quantity is protected;
|
||||
myTenthColor: Color from Quantity is protected;
|
||||
myIsActive :Boolean from Standard;
|
||||
myIsDisplayed: Boolean from Standard;
|
||||
myDrawMode: GridDrawMode from Aspect;
|
||||
|
||||
end Grid from Aspect;
|
121
src/Aspect/Aspect_Grid.cxx
Executable file
121
src/Aspect/Aspect_Grid.cxx
Executable file
@@ -0,0 +1,121 @@
|
||||
//
|
||||
// Updated: GG IMP230300 Add grid color parameters in constructor
|
||||
// and add new methods SetColors() & Colors()
|
||||
//
|
||||
|
||||
#include <Aspect_Grid.ixx>
|
||||
|
||||
|
||||
Aspect_Grid::Aspect_Grid(
|
||||
const Quantity_Length anXOrigin,
|
||||
const Quantity_Length anYOrigin,
|
||||
const Quantity_PlaneAngle anAngle,
|
||||
const Quantity_Color& aColor,
|
||||
const Quantity_Color& aTenthColor)
|
||||
: myRotationAngle(anAngle),
|
||||
myXOrigin(anXOrigin),
|
||||
myYOrigin(anYOrigin),
|
||||
myColor(aColor),
|
||||
myTenthColor(aTenthColor),
|
||||
myIsActive(Standard_False),
|
||||
myDrawMode(Aspect_GDM_Lines)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Aspect_Grid::SetXOrigin(const Quantity_Length anOrigin) {
|
||||
myXOrigin = anOrigin;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void Aspect_Grid::SetYOrigin(const Quantity_Length anOrigin) {
|
||||
myYOrigin = anOrigin;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void Aspect_Grid::SetRotationAngle(const Quantity_Length anAngle){
|
||||
|
||||
|
||||
myRotationAngle = anAngle;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
void Aspect_Grid::Rotate(const Quantity_PlaneAngle anAngle) {
|
||||
myRotationAngle += anAngle;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
void Aspect_Grid::Translate(const Quantity_Length aDx,
|
||||
const Quantity_Length aDy) {
|
||||
myXOrigin += aDx;
|
||||
myYOrigin += aDy;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void Aspect_Grid::SetColors(const Quantity_Color& aColor,
|
||||
const Quantity_Color& aTenthColor) {
|
||||
myColor = aColor;
|
||||
myTenthColor = aTenthColor;
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void Aspect_Grid::Colors(Quantity_Color& aColor,
|
||||
Quantity_Color& aTenthColor) const {
|
||||
aColor = myColor;
|
||||
aTenthColor = myTenthColor;
|
||||
}
|
||||
|
||||
void Aspect_Grid::Hit(const Quantity_Length X,
|
||||
const Quantity_Length Y,
|
||||
Quantity_Length& gridX,
|
||||
Quantity_Length& gridY) const {
|
||||
if (myIsActive) {
|
||||
Compute(X,Y,gridX,gridY);}
|
||||
else{
|
||||
gridX = X;
|
||||
gridY = Y;
|
||||
}
|
||||
}
|
||||
void Aspect_Grid::Activate () {
|
||||
myIsActive = Standard_True;
|
||||
}
|
||||
|
||||
void Aspect_Grid::Deactivate () {
|
||||
myIsActive = Standard_False;
|
||||
}
|
||||
|
||||
Quantity_Length Aspect_Grid::XOrigin() const {
|
||||
return myXOrigin;
|
||||
}
|
||||
|
||||
Quantity_Length Aspect_Grid::YOrigin() const {
|
||||
return myYOrigin;
|
||||
}
|
||||
|
||||
Quantity_Length Aspect_Grid::RotationAngle() const {
|
||||
return myRotationAngle;
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_Grid::IsActive() const {
|
||||
return myIsActive;
|
||||
}
|
||||
void Aspect_Grid::Display() {}
|
||||
|
||||
void Aspect_Grid::Erase () const {}
|
||||
|
||||
void Aspect_Grid::UpdateDisplay () {}
|
||||
|
||||
|
||||
Standard_Boolean Aspect_Grid::IsDisplayed() const {
|
||||
return Standard_False;}
|
||||
|
||||
void Aspect_Grid::SetDrawMode(const Aspect_GridDrawMode aDrawMode) {
|
||||
myDrawMode = aDrawMode;
|
||||
UpdateDisplay();
|
||||
}
|
||||
Aspect_GridDrawMode Aspect_Grid::DrawMode() const {
|
||||
return myDrawMode;
|
||||
}
|
8
src/Aspect/Aspect_Handle.cxx
Executable file
8
src/Aspect/Aspect_Handle.cxx
Executable file
@@ -0,0 +1,8 @@
|
||||
#include <Aspect_Handle.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_Handle)
|
||||
{
|
||||
static Handle(Standard_Type) _atype = new Standard_Type ("Aspect_Handle", sizeof (Aspect_Handle));
|
||||
return _atype;
|
||||
}
|
28
src/Aspect/Aspect_Handle.hxx
Executable file
28
src/Aspect/Aspect_Handle.hxx
Executable file
@@ -0,0 +1,28 @@
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Aspect_Handle.hxx */
|
||||
/*==== Role : The header file of primitive type "Handle" from packages */
|
||||
/*==== "Xw" & "WNT" */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
/*============================================================================*/
|
||||
|
||||
#ifndef _Aspect_Handle_HeaderFile
|
||||
#define _Aspect_Handle_HeaderFile
|
||||
|
||||
#ifdef WNT
|
||||
typedef void* HANDLE;
|
||||
typedef HANDLE Aspect_Handle;
|
||||
#else
|
||||
typedef unsigned long Aspect_Handle;
|
||||
#endif /* WNT */
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
/*==== Definition de Type ====================================================*/
|
||||
|
||||
#include <Standard_Macro.hxx>
|
||||
class Handle(Standard_Type);
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_Handle);
|
||||
|
||||
/*============================================================================*/
|
||||
#endif
|
||||
|
||||
#endif /* _Aspect_Handle_HeaderFile */
|
13
src/Aspect/Aspect_IFStream.cxx
Executable file
13
src/Aspect/Aspect_IFStream.cxx
Executable file
@@ -0,0 +1,13 @@
|
||||
// File: Aspect_IFStream.cxx
|
||||
// Created: Fri Jan 26 12:00:00 2001
|
||||
// Author: SPK
|
||||
|
||||
|
||||
#include <Aspect_IFStream.hxx>
|
||||
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_IFStream)
|
||||
{
|
||||
static Handle(Standard_Type) _atype =
|
||||
new Standard_Type("Aspect_IFStream", sizeof(Aspect_IFStream));
|
||||
return _atype;
|
||||
}
|
15
src/Aspect/Aspect_IFStream.hxx
Executable file
15
src/Aspect/Aspect_IFStream.hxx
Executable file
@@ -0,0 +1,15 @@
|
||||
// File: Aspect_IFStream.cxx
|
||||
// Created: Fri Jan 26 12:00:00 2001
|
||||
// Author: SPK
|
||||
|
||||
#ifndef _Aspect_IFStream_HeaderFile
|
||||
#define _Aspect_IFStream_HeaderFile
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
typedef ifstream* Aspect_IFStream;
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_IFStream);
|
||||
|
||||
#endif
|
45
src/Aspect/Aspect_IndexPixel.cdl
Executable file
45
src/Aspect/Aspect_IndexPixel.cdl
Executable file
@@ -0,0 +1,45 @@
|
||||
|
||||
-- File: Aspect_IndexPixel.cdl
|
||||
-- Created: Fri Jul 23 16:25:00 1993
|
||||
-- Author: Jean Louis FRENKEL
|
||||
-- <jlf@sparc3>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
class IndexPixel from Aspect inherits Pixel from Aspect
|
||||
|
||||
is
|
||||
Create
|
||||
returns IndexPixel from Aspect;
|
||||
|
||||
Create (anIndex: Integer from Standard)
|
||||
returns IndexPixel from Aspect;
|
||||
|
||||
Value(me)
|
||||
returns Integer from Standard
|
||||
is static ;
|
||||
|
||||
SetValue(me: in out; anIndex: Integer from Standard) is static ;
|
||||
|
||||
HashCode (me; Upper : Integer )
|
||||
returns Integer
|
||||
is redefined static ;
|
||||
---Level: Public
|
||||
---Purpose: Returns a hashed value denoting <me>. This value is in
|
||||
-- the range 1..<Upper>.
|
||||
---C++: function call
|
||||
|
||||
Print( me ; s : in out OStream )
|
||||
is redefined static ;
|
||||
---Level: Public
|
||||
---Purpose : Prints the contents of <me> on the stream <s>
|
||||
|
||||
IsEqual(me; Other : IndexPixel from Aspect) returns Boolean;
|
||||
---C++: alias operator==
|
||||
|
||||
IsNotEqual(me; Other : IndexPixel from Aspect) returns Boolean;
|
||||
---C++: alias operator!=
|
||||
|
||||
fields
|
||||
myIndex: Integer from Standard;
|
||||
|
||||
end IndexPixel from Aspect;
|
55
src/Aspect/Aspect_IndexPixel.cxx
Executable file
55
src/Aspect/Aspect_IndexPixel.cxx
Executable file
@@ -0,0 +1,55 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
#include <Aspect_IndexPixel.ixx>
|
||||
|
||||
Aspect_IndexPixel::Aspect_IndexPixel () {
|
||||
|
||||
myIndex = 0;
|
||||
|
||||
}
|
||||
|
||||
Aspect_IndexPixel::Aspect_IndexPixel (const Standard_Integer anIndex) {
|
||||
|
||||
myIndex = anIndex;
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_IndexPixel::Value() const {
|
||||
|
||||
return myIndex;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Aspect_IndexPixel::SetValue(const Standard_Integer anIndex) {
|
||||
|
||||
myIndex = anIndex;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_IndexPixel::Print(Standard_OStream& s) const
|
||||
|
||||
{
|
||||
s << dec << setw(4) << myIndex;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Hascode : Computes a hascoding value for a given Aspect_IndexPixel
|
||||
// ------------------------------------------------------------------
|
||||
Standard_Integer Aspect_IndexPixel::HashCode(const Standard_Integer Upper) const
|
||||
{
|
||||
return ( myIndex % Upper ) + 1 ;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean Aspect_IndexPixel::IsEqual(const Aspect_IndexPixel& Other) const
|
||||
{
|
||||
return (myIndex == Other.myIndex);
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_IndexPixel::IsNotEqual(const Aspect_IndexPixel& Other) const
|
||||
{
|
||||
return !IsEqual(Other);
|
||||
}
|
140
src/Aspect/Aspect_LineStyle.cdl
Executable file
140
src/Aspect/Aspect_LineStyle.cdl
Executable file
@@ -0,0 +1,140 @@
|
||||
--
|
||||
-- File: Aspect_LineStyle.cdl
|
||||
-- Created: Mardi 7 Septembre 1993
|
||||
-- Author: GG
|
||||
-- Updated: JLF (Reason LineStyle MUST be given in METER ) 2 Mars 94
|
||||
--
|
||||
---Copyright: MatraDatavision 1991-1993
|
||||
--
|
||||
|
||||
class LineStyle from Aspect
|
||||
|
||||
---Version:
|
||||
|
||||
---Purpose: This class allows the definition of a Line Style.
|
||||
-- The Style can be Predefined or defined by the user
|
||||
|
||||
---Keywords: LineStyle
|
||||
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
TypeOfLine from Aspect,
|
||||
Array1OfLength from TColQuantity,
|
||||
HArray1OfLength from TColQuantity
|
||||
|
||||
raises
|
||||
LineStyleDefinitionError from Aspect
|
||||
|
||||
is
|
||||
Create
|
||||
returns LineStyle from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Creates a line style with the default value of
|
||||
-- LineStyle type : SOLID
|
||||
--
|
||||
raises LineStyleDefinitionError from Aspect;
|
||||
-- if the maximum number of line style is exceeded
|
||||
|
||||
Create ( Type : TypeOfLine from Aspect )
|
||||
returns LineStyle from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Creates the line style <Type>.
|
||||
|
||||
Create ( Style : Array1OfLength from TColQuantity )
|
||||
returns LineStyle from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Creates a line style from METER Float style descriptor .
|
||||
-- Style Descriptor is :
|
||||
-- Each Odd float described the Drawn part of the style .
|
||||
-- Each Even float described the Hidden part of the style .
|
||||
-- (e.g) [0.010,0.002,0.005,0.004]
|
||||
-- Draw 10 MM ,Move 2 MM,Draw 5 MM ..
|
||||
raises LineStyleDefinitionError from Aspect;
|
||||
-- if the METER float values are <= 0.
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
Assign ( me : in out ;
|
||||
Other : LineStyle from Aspect )
|
||||
returns LineStyle from Aspect is static;
|
||||
---Level: Public
|
||||
---Purpose: Updates the line style <me> from the definition of the
|
||||
-- line style <Other>.
|
||||
---Category: Methods to modify the class definition
|
||||
---C++: alias operator =
|
||||
---C++: return &
|
||||
|
||||
SetValues ( me : in out ;
|
||||
Type : TypeOfLine from Aspect ) is static;
|
||||
---Level: Public
|
||||
---Purpose: Updates the line style <me> from the definition of the
|
||||
-- line style <Type>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetValues ( me : in out ;
|
||||
Style : Array1OfLength from TColQuantity )
|
||||
---Level: Public
|
||||
---Purpose: Updates a line style with the new Float descriptor
|
||||
raises LineStyleDefinitionError from Aspect is static;
|
||||
-- if the METER float values are <= 0.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
Style ( me )
|
||||
returns TypeOfLine from Aspect is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the type of the line style <me>
|
||||
---Category: Inquire methods
|
||||
|
||||
Length ( me )
|
||||
returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the components length of the line style
|
||||
---Category: Inquire methods
|
||||
|
||||
Values ( me )
|
||||
returns Array1OfLength from TColQuantity is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the components of a line style
|
||||
---Category: Inquire methods
|
||||
---C++: return const &
|
||||
|
||||
IsEqual(me; Other : LineStyle from Aspect) returns Boolean;
|
||||
---C++: alias operator==
|
||||
|
||||
IsNotEqual(me; Other : LineStyle from Aspect) returns Boolean;
|
||||
---C++: alias operator!=
|
||||
|
||||
----------------------------
|
||||
-- Category: Private methods
|
||||
----------------------------
|
||||
|
||||
PredefinedStyle ( me : in out ;
|
||||
Type : TypeOfLine from Aspect )
|
||||
---Level: Internal
|
||||
---Purpose: Set MyLineDescriptor with the predefined style values
|
||||
-- according of type
|
||||
---Category: Private methods
|
||||
returns HArray1OfLength from TColQuantity is static private;
|
||||
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
--
|
||||
-- Class : Aspect_LineStyle
|
||||
--
|
||||
-- Purpose : Declaration of variables specific to line styles
|
||||
--
|
||||
|
||||
MyLineType : TypeOfLine from Aspect;
|
||||
MyLineDescriptor : HArray1OfLength from TColQuantity;
|
||||
|
||||
end LineStyle;
|
165
src/Aspect/Aspect_LineStyle.cxx
Executable file
165
src/Aspect/Aspect_LineStyle.cxx
Executable file
@@ -0,0 +1,165 @@
|
||||
|
||||
// File Aspect_LineStyle.cxx
|
||||
// Created Septembre 1992
|
||||
// Author GG
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux Type de traits
|
||||
|
||||
//-Warning Un style est definie, soit par son type predefini TOL_...
|
||||
// soit par sa description en METRE
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_LineStyle.ixx>
|
||||
#include <Aspect_Units.hxx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// MyLineType : TypeOfLine from Aspect;
|
||||
// MyLineDescriptor : HArray1OfReal from TColStd;
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_LineStyle::Aspect_LineStyle () : MyLineDescriptor(PredefinedStyle(Aspect_TOL_SOLID)) {
|
||||
}
|
||||
|
||||
Aspect_LineStyle::Aspect_LineStyle (const Aspect_TypeOfLine Type) : MyLineDescriptor(PredefinedStyle(Type)) {
|
||||
}
|
||||
|
||||
Aspect_LineStyle::Aspect_LineStyle (const TColQuantity_Array1OfLength& UserDefinedStyle) {
|
||||
Standard_Integer i ;
|
||||
|
||||
MyLineType = Aspect_TOL_USERDEFINED ;
|
||||
// Modif CAL 8/2/95
|
||||
MyLineDescriptor = new TColQuantity_HArray1OfLength
|
||||
(UserDefinedStyle.Lower(), UserDefinedStyle.Upper()) ;
|
||||
|
||||
for( i=UserDefinedStyle.Lower() ; i<=UserDefinedStyle.Upper() ; i++ ) {
|
||||
// Modif CAL 8/2/95
|
||||
MyLineDescriptor->SetValue(i, UserDefinedStyle(i)) ;
|
||||
if( UserDefinedStyle(i) <= 0. )
|
||||
Aspect_LineStyleDefinitionError::Raise ("Bad Descriptor") ;
|
||||
}
|
||||
}
|
||||
|
||||
Aspect_LineStyle& Aspect_LineStyle::Assign (const Aspect_LineStyle& Other) {
|
||||
Standard_Integer i ;
|
||||
|
||||
// Modif CAL 8/2/95
|
||||
MyLineDescriptor = new TColQuantity_HArray1OfLength
|
||||
((Other.Values()).Lower(), (Other.Values()).Upper()) ;
|
||||
MyLineType = Other.MyLineType ;
|
||||
|
||||
if( MyLineType != Aspect_TOL_SOLID ) {
|
||||
for( i=MyLineDescriptor->Lower() ;
|
||||
i<=MyLineDescriptor->Upper() ; i++ ){
|
||||
// Modif CAL 8/2/95
|
||||
MyLineDescriptor->SetValue(i, (Other.Values())(i)) ;
|
||||
if( (Other.Values())(i) <= 0. )
|
||||
Aspect_LineStyleDefinitionError::Raise ("Bad Descriptor") ;
|
||||
}
|
||||
}
|
||||
|
||||
return (*this);
|
||||
|
||||
}
|
||||
|
||||
void Aspect_LineStyle::SetValues (const Aspect_TypeOfLine Type) {
|
||||
|
||||
MyLineDescriptor = PredefinedStyle(Type) ;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_LineStyle::SetValues (const TColQuantity_Array1OfLength& UserDefinedStyle) {
|
||||
Standard_Integer i ;
|
||||
|
||||
// Modif CAL 8/2/95
|
||||
MyLineDescriptor = new TColQuantity_HArray1OfLength
|
||||
(UserDefinedStyle.Lower(), UserDefinedStyle.Upper()) ;
|
||||
MyLineType = Aspect_TOL_USERDEFINED ;
|
||||
|
||||
for( i=UserDefinedStyle.Lower() ; i<=UserDefinedStyle.Upper() ; i++ ) {
|
||||
// Modif CAL 8/2/95
|
||||
MyLineDescriptor->SetValue(i, UserDefinedStyle(i)) ;
|
||||
if( UserDefinedStyle(i) <= 0. )
|
||||
Aspect_LineStyleDefinitionError::Raise ("Bad Descriptor") ;
|
||||
}
|
||||
}
|
||||
|
||||
Aspect_TypeOfLine Aspect_LineStyle::Style () const {
|
||||
|
||||
return (MyLineType);
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_LineStyle::Length () const {
|
||||
|
||||
if( MyLineDescriptor.IsNull() ) return (0) ;
|
||||
else return (MyLineDescriptor->Length());
|
||||
}
|
||||
|
||||
const TColQuantity_Array1OfLength& Aspect_LineStyle::Values () const {
|
||||
|
||||
return (MyLineDescriptor->Array1());
|
||||
}
|
||||
|
||||
Handle(TColQuantity_HArray1OfLength) Aspect_LineStyle::PredefinedStyle(const Aspect_TypeOfLine Type) {
|
||||
Handle(TColQuantity_HArray1OfLength) descriptor ;
|
||||
|
||||
MyLineType = Type ;
|
||||
switch ( Type ) {
|
||||
case Aspect_TOL_USERDEFINED :
|
||||
Aspect_LineStyleDefinitionError::Raise ("Bad Line Type Style");
|
||||
case Aspect_TOL_SOLID :
|
||||
descriptor = new TColQuantity_HArray1OfLength(1,1) ;
|
||||
descriptor->SetValue(1,0.) ;
|
||||
break ;
|
||||
case Aspect_TOL_DASH :
|
||||
descriptor = new TColQuantity_HArray1OfLength(1,2) ;
|
||||
descriptor->SetValue(1,2.0 MILLIMETER) ;
|
||||
descriptor->SetValue(2,1.0 MILLIMETER) ;
|
||||
break ;
|
||||
case Aspect_TOL_DOT :
|
||||
descriptor = new TColQuantity_HArray1OfLength(1,2) ;
|
||||
descriptor->SetValue(1,0.2 MILLIMETER) ;
|
||||
descriptor->SetValue(2,0.5 MILLIMETER) ;
|
||||
break ;
|
||||
case Aspect_TOL_DOTDASH :
|
||||
descriptor = new TColQuantity_HArray1OfLength(1,4) ;
|
||||
descriptor->SetValue(1,10.0 MILLIMETER) ;
|
||||
descriptor->SetValue(2,1.0 MILLIMETER) ;
|
||||
descriptor->SetValue(3,2.0 MILLIMETER) ;
|
||||
descriptor->SetValue(4,1.0 MILLIMETER) ;
|
||||
break ;
|
||||
default :
|
||||
descriptor.Nullify() ;
|
||||
}
|
||||
|
||||
return (descriptor) ;
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_LineStyle::IsEqual(const Aspect_LineStyle& Other) const
|
||||
{
|
||||
return (
|
||||
(MyLineType == Other.MyLineType) &&
|
||||
(MyLineDescriptor == Other.MyLineDescriptor));
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_LineStyle::IsNotEqual(const Aspect_LineStyle& Other) const
|
||||
{
|
||||
return !IsEqual(Other);
|
||||
}
|
68
src/Aspect/Aspect_MarkMap.cdl
Executable file
68
src/Aspect/Aspect_MarkMap.cdl
Executable file
@@ -0,0 +1,68 @@
|
||||
--
|
||||
-- File: Aspect_MarkMap.cdl
|
||||
-- Created: 13/01/95
|
||||
-- Author: GG
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
class MarkMap from Aspect inherits TShared from MMgt
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a MarkMap object.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
uses
|
||||
MarkerStyle from Aspect,
|
||||
MarkMapEntry from Aspect,
|
||||
SequenceOfMarkMapEntry from Aspect
|
||||
|
||||
raises
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
Create returns mutable MarkMap from Aspect;
|
||||
|
||||
AddEntry (me : mutable; AnEntry : MarkMapEntry from Aspect)
|
||||
---Level: Public
|
||||
---Purpose: Adds an entry in the mark map <me>.
|
||||
-- Warning: Raises BadAccess if MarkMap size is exceeded.
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
AddEntry (me : mutable; aStyle : MarkerStyle from Aspect)
|
||||
returns Integer from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Search an identical marker style entry in the mark map <me>
|
||||
-- and returns the MarkMapEntry Index if exist.
|
||||
-- Or add a new entry and returns the computed MarkMapEntry index used.
|
||||
|
||||
Size( me ) returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Allocated markmap Size
|
||||
|
||||
Index( me ; aMarkmapIndex : Integer ) returns Integer from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the MarkMapEntry.Index of the MarkMap
|
||||
-- at rank <aMarkmapIndex> .
|
||||
raises BadAccess from Aspect is static;
|
||||
---Trigger: Raises BadAccess if the index less than 1 or
|
||||
-- greater than Size.
|
||||
|
||||
Dump( me ) ;
|
||||
|
||||
Entry ( me ;
|
||||
AnIndex : Integer from Standard )
|
||||
returns MarkMapEntry from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Returns the Mark map entry with the index <AnIndex>.
|
||||
-- Warning: Raises BadAccess if the index less than 1 or
|
||||
-- greater than Size.
|
||||
raises BadAccess from Aspect is static;
|
||||
|
||||
fields
|
||||
|
||||
mydata : SequenceOfMarkMapEntry from Aspect is protected;
|
||||
|
||||
end MarkMap ;
|
106
src/Aspect/Aspect_MarkMap.cxx
Executable file
106
src/Aspect/Aspect_MarkMap.cxx
Executable file
@@ -0,0 +1,106 @@
|
||||
// File Aspect_MarkMap.cxx
|
||||
// Created Janvier 1995
|
||||
// Author GG
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992,1993,1994
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux Ensembles
|
||||
// de Markers
|
||||
|
||||
//-Warning Une MarkMap est definie par un ensemble de MarkMapEntries
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_MarkMap.ixx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// mydata : SequenceOfMarkMapEntry from Aspect is protected
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_MarkMap::Aspect_MarkMap( ) {
|
||||
Aspect_MarkMapEntry theDefaultEntry;
|
||||
|
||||
AddEntry(theDefaultEntry);
|
||||
}
|
||||
|
||||
void Aspect_MarkMap::AddEntry (const Aspect_MarkMapEntry& AnEntry) {
|
||||
Standard_Integer i,index = AnEntry.Index();
|
||||
Aspect_MarkMapEntry theEntry;
|
||||
|
||||
for( i=1 ; i<=mydata.Length() ; i++ ) {
|
||||
theEntry = mydata.Value(i);
|
||||
if( index == theEntry.Index() ) break;
|
||||
}
|
||||
|
||||
if( i > mydata.Length() ) {
|
||||
mydata.Append( AnEntry );
|
||||
} else {
|
||||
mydata.SetValue(i,AnEntry);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_MarkMap::AddEntry (const Aspect_MarkerStyle &aStyle) {
|
||||
Aspect_MarkMapEntry theEntry ;
|
||||
Standard_Integer i,maxindex = 0 ;
|
||||
|
||||
for( i=1 ; i<=mydata.Length() ; i++ ) {
|
||||
theEntry = mydata.Value(i) ;
|
||||
maxindex = Max(maxindex,theEntry.Index()) ;
|
||||
if( theEntry.Style() == aStyle ) return theEntry.Index() ;
|
||||
}
|
||||
|
||||
maxindex++ ;
|
||||
theEntry.SetValue(maxindex,aStyle) ;
|
||||
mydata.Append( theEntry ) ;
|
||||
return maxindex ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_MarkMap::Size() const {
|
||||
|
||||
return mydata.Length() ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_MarkMap::Index(const Standard_Integer anIndex) const {
|
||||
|
||||
if( anIndex < 1 || anIndex > Size() ) {
|
||||
Aspect_BadAccess::Raise ("Undefined markmap Index");
|
||||
}
|
||||
|
||||
Aspect_MarkMapEntry theEntry = mydata.Value(anIndex) ;
|
||||
|
||||
return theEntry.Index() ;
|
||||
}
|
||||
|
||||
Aspect_MarkMapEntry Aspect_MarkMap::Entry (const Standard_Integer AnIndex) const {
|
||||
|
||||
if( AnIndex < 1 || AnIndex > mydata.Length() )
|
||||
Aspect_BadAccess::Raise ("Aspect_MarkMap::Entry Bad Index");
|
||||
|
||||
return mydata.Value(AnIndex);
|
||||
}
|
||||
|
||||
void Aspect_MarkMap::Dump () const {
|
||||
|
||||
Standard_Integer i ;
|
||||
|
||||
cout << "Markmap Dump-->\n" ;
|
||||
|
||||
for ( i = 1 ; i <= Size() ; i++ ) (Entry(i)).Dump() ;
|
||||
|
||||
cout << "<--End Markmap Dump\n" ;
|
||||
}
|
95
src/Aspect/Aspect_MarkMapEntry.cdl
Executable file
95
src/Aspect/Aspect_MarkMapEntry.cdl
Executable file
@@ -0,0 +1,95 @@
|
||||
|
||||
--
|
||||
-- File: Aspect_MarkMapEntry.cdl
|
||||
-- Created: 13/01/95
|
||||
-- Author: GG
|
||||
--
|
||||
---Copyright: MatraDatavision 1995
|
||||
--
|
||||
|
||||
class MarkMapEntry from Aspect
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a markmap entrys.
|
||||
-- A markmap entry is an association between
|
||||
-- a MarkerStyle object and an index in the markmap.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
MarkerStyle from Aspect
|
||||
|
||||
raises
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
Create
|
||||
returns MarkMapEntry from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates an unallocated markmap entry
|
||||
|
||||
Create ( index : Integer from Standard;
|
||||
style : MarkerStyle from Aspect)
|
||||
returns MarkMapEntry;
|
||||
---Level: Public
|
||||
---Purpose: Creates an allocated markmap entry
|
||||
|
||||
Create ( entry : MarkMapEntry from Aspect )
|
||||
returns MarkMapEntry
|
||||
---Level: Public
|
||||
---Purpose: Creates an allocated markmap entry.
|
||||
-- Warning: Raises error if the markmap entry <entry>
|
||||
-- is unallocated.
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
SetValue ( me: in out; index : Integer from Standard;
|
||||
style : MarkerStyle from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Sets markmap entry value and allocates it.
|
||||
|
||||
SetValue ( me: in out; entry : MarkMapEntry from Aspect);
|
||||
---Level: Public
|
||||
---Purpose: Sets markmap entry value and allocates it.
|
||||
---C++: alias operator =
|
||||
|
||||
SetStyle ( me: in out; Style : MarkerStyle from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Sets the marker style of markmap entry.
|
||||
|
||||
Style ( me ) returns MarkerStyle from Aspect
|
||||
---Warning: Raises error if the markmap entry is unallocated .
|
||||
raises BadAccess from Aspect;
|
||||
---C++: return const &
|
||||
|
||||
SetIndex ( me: in out; index : Integer from Standard);
|
||||
---Level: Public
|
||||
---Purpose: Sets index value of a markmap entry.
|
||||
|
||||
Index ( me ) returns Integer from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns index value of a markmap entry.
|
||||
-- Warning: Raises error if the markmap entry is unallocated .
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
Free ( me : in out );
|
||||
---Level: Public
|
||||
---Purpose: Unallocates the markmap entry.
|
||||
|
||||
IsAllocated ( me ) returns Boolean from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns True if the markmap entry is allocated.
|
||||
-- Warning: A markmap entry is allocated when the marker and
|
||||
-- the index is defined.
|
||||
|
||||
Dump( me ) ;
|
||||
---Level: Internal
|
||||
|
||||
fields
|
||||
MyStyle : MarkerStyle from Aspect;
|
||||
MyIndex : Integer from Standard;
|
||||
MyStyleIsDef : Boolean from Standard;
|
||||
MyIndexIsDef : Boolean from Standard;
|
||||
|
||||
end MarkMapEntry from Aspect;
|
140
src/Aspect/Aspect_MarkMapEntry.cxx
Executable file
140
src/Aspect/Aspect_MarkMapEntry.cxx
Executable file
@@ -0,0 +1,140 @@
|
||||
|
||||
// File Aspect_MarkMapEntry.cxx
|
||||
// Created Janvier 1995
|
||||
// Author GG
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992,1993,1994
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux Entries de
|
||||
// Markers
|
||||
|
||||
//-Warning Une entry est definie par un index associee a un Marker style
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_MarkMapEntry.ixx>
|
||||
#include <TColQuantity_Array1OfLength.hxx>
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// MyStyle : MarkerStyle from Aspect
|
||||
// MyIndex : Integer from Standard
|
||||
// MyStyleIsDef : Boolean from Standard
|
||||
// MyIndexIsDef : Boolean from Standard
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_MarkMapEntry::Aspect_MarkMapEntry() :
|
||||
MyStyle(),MyIndex(0),MyStyleIsDef(Standard_True),MyIndexIsDef(Standard_True) {
|
||||
}
|
||||
|
||||
Aspect_MarkMapEntry::Aspect_MarkMapEntry (const Standard_Integer index, const Aspect_MarkerStyle &style) :
|
||||
MyStyle(style),MyIndex(index),MyStyleIsDef(Standard_True),MyIndexIsDef(Standard_True) {
|
||||
}
|
||||
|
||||
Aspect_MarkMapEntry::Aspect_MarkMapEntry (const Aspect_MarkMapEntry& entry) :
|
||||
MyStyle(entry.MyStyle),MyIndex(entry.MyIndex),MyStyleIsDef(Standard_True),MyIndexIsDef(Standard_True) {
|
||||
|
||||
if ( !entry.MyStyleIsDef || !entry.MyIndexIsDef ) {
|
||||
Aspect_BadAccess::Raise("Unallocated MarkMapEntry") ;
|
||||
}
|
||||
}
|
||||
|
||||
void Aspect_MarkMapEntry::SetValue (const Standard_Integer index, const Aspect_MarkerStyle &style) {
|
||||
|
||||
MyStyleIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
MyStyle = style;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_MarkMapEntry::SetValue (const Aspect_MarkMapEntry& entry) {
|
||||
|
||||
if ( !entry.MyStyleIsDef || !entry.MyIndexIsDef ) {
|
||||
Aspect_BadAccess::Raise("Unallocated MarkMapEntry") ;
|
||||
}
|
||||
else {
|
||||
MyStyleIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = entry.MyIndex;
|
||||
MyStyle = entry.MyStyle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Aspect_MarkMapEntry::SetStyle (const Aspect_MarkerStyle &style) {
|
||||
|
||||
MyStyleIsDef = Standard_True;
|
||||
MyStyle = style;
|
||||
|
||||
}
|
||||
|
||||
const Aspect_MarkerStyle& Aspect_MarkMapEntry::Style () const {
|
||||
|
||||
if ( !MyStyleIsDef || !MyIndexIsDef )
|
||||
Aspect_BadAccess::Raise("Unallocated MarkMapEntry") ;
|
||||
|
||||
return MyStyle;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_MarkMapEntry::SetIndex (const Standard_Integer index) {
|
||||
|
||||
MyStyleIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_MarkMapEntry::Index () const {
|
||||
|
||||
if ( !MyStyleIsDef || !MyIndexIsDef )
|
||||
Aspect_BadAccess::Raise("Unallocated MarkMapEntry");
|
||||
|
||||
return MyIndex;
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_MarkMapEntry::IsAllocated () const {
|
||||
|
||||
return ( MyStyleIsDef && MyIndexIsDef ) ;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_MarkMapEntry::Free () {
|
||||
|
||||
MyStyleIsDef = Standard_False;
|
||||
MyIndexIsDef = Standard_False;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_MarkMapEntry::Dump () const {
|
||||
|
||||
Aspect_TypeOfMarker type = MyStyle.Type() ;
|
||||
Standard_Integer i,length = MyStyle.Length() ;
|
||||
Standard_Boolean draw = Standard_False ;
|
||||
Standard_Real X,Y;
|
||||
|
||||
cout << " Aspect_MarkMapEntry::Dump ()\n";
|
||||
cout << " MyStyleIsDef : " << (MyStyleIsDef) ? "True\n" : "False\n";
|
||||
cout << " MyIndexIsDef : " << (MyIndexIsDef) ? "True\n" : "False\n";
|
||||
cout << " MarkerStyle : " << (Standard_Integer) type << " Length : " << length << "\n";//WNT
|
||||
if( length ) {
|
||||
for( i=1 ; i<=length ; i++ )
|
||||
draw = MyStyle.Values(i,X,Y);
|
||||
cout << " value("<< i << ") : " << X << "," << Y << "," << draw << "\n";
|
||||
}
|
||||
cout << flush;
|
||||
}
|
159
src/Aspect/Aspect_MarkerStyle.cdl
Executable file
159
src/Aspect/Aspect_MarkerStyle.cdl
Executable file
@@ -0,0 +1,159 @@
|
||||
--
|
||||
-- File: Aspect_MarkerStyle.cdl
|
||||
-- Created: Vendredi 13 Janvier 1995
|
||||
-- Author: GG
|
||||
--
|
||||
---Copyright: MatraDatavision 1991-1993
|
||||
--
|
||||
|
||||
class MarkerStyle from Aspect
|
||||
|
||||
---Version:
|
||||
|
||||
---Purpose: This class defines a Marker Style.
|
||||
-- The Style can be Predefined or defined by the user
|
||||
-- A user defined style must be described in the space <-1,+1>
|
||||
|
||||
---Keywords: MarkerStyle
|
||||
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
TypeOfMarker from Aspect,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfBoolean from TColStd,
|
||||
HArray1OfBoolean from TColStd,
|
||||
Array1OfShortReal from TShort,
|
||||
HArray1OfShortReal from TShort
|
||||
|
||||
raises
|
||||
MarkerStyleDefinitionError from Aspect
|
||||
|
||||
is
|
||||
Create returns MarkerStyle from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates a marker style with the default value of
|
||||
-- MarkerStyle type : POINT
|
||||
--
|
||||
|
||||
Create ( aType : TypeOfMarker ) returns MarkerStyle from Aspect ;
|
||||
---Level: Public
|
||||
---Purpose: Creates the marker style <aType>.
|
||||
|
||||
Create ( aXpoint : Array1OfReal ;
|
||||
aYpoint : Array1OfReal )
|
||||
returns MarkerStyle from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Creates a marker style from a implicit draw point
|
||||
--descriptor .
|
||||
-- Each coordinate <aXpoint(i),aYpoint(i)> must be defined
|
||||
--in the space -1,+1.
|
||||
raises MarkerStyleDefinitionError;
|
||||
---Trigger:
|
||||
-- if <aXpoint>,<aYpoint> have different length.
|
||||
-- if one coordinate is <-1 or >+1.
|
||||
|
||||
Create ( aXpoint : Array1OfReal ;
|
||||
aYpoint : Array1OfReal ;
|
||||
aSpoint : Array1OfBoolean )
|
||||
returns MarkerStyle from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Creates a marker style from a move-draw point descriptor .
|
||||
-- Each coordinate <aXpoint(i),aYpoint(i)> must be defined
|
||||
--in the space -1,+1.
|
||||
-- Each status point <aSpoint(i)> must be TRUE for drawing
|
||||
--or FALSE for moving to the last at this point .
|
||||
raises MarkerStyleDefinitionError;
|
||||
---Trigger:
|
||||
-- if <aXpoint>,<aYpoint>,<aSpoint> have different length.
|
||||
-- if one coordinate is <-1 or >+1
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
Assign ( me : in out ;
|
||||
Other : MarkerStyle from Aspect )
|
||||
returns MarkerStyle from Aspect is static;
|
||||
---Level: Public
|
||||
---Purpose: Updates the marker style <me> from the definition of the
|
||||
-- marker style <Other>.
|
||||
---Category: Methods to modify the class definition
|
||||
---C++: alias operator =
|
||||
---C++: return &
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
Type ( me ) returns TypeOfMarker is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the type of the marker style <me>
|
||||
---Category: Inquire methods
|
||||
|
||||
Length ( me ) returns Integer is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the components length of the marker descriptors
|
||||
---Category: Inquire methods
|
||||
|
||||
Values ( me ; aRank : Integer ;
|
||||
aX,aY : out Real ) returns Boolean
|
||||
---Level: Public
|
||||
---Purpose: Returns the point and status of a marker style
|
||||
--descriptor of rank <aRank>.
|
||||
raises MarkerStyleDefinitionError is static;
|
||||
---Trigger:
|
||||
-- If aRank is < 1 or > Length()
|
||||
---Category: Inquire methods
|
||||
|
||||
XValues ( me ) returns Array1OfShortReal is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the X vector of a marker style descriptor
|
||||
---Category: Inquire methods
|
||||
---C++: return const &
|
||||
|
||||
YValues ( me ) returns Array1OfShortReal is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Y vector of a marker style descriptor
|
||||
---Category: Inquire methods
|
||||
---C++: return const &
|
||||
|
||||
SValues ( me ) returns Array1OfBoolean is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the State vector of a marker style descriptor
|
||||
---Category: Inquire methods
|
||||
---C++: return const &
|
||||
|
||||
IsEqual(me; Other : MarkerStyle from Aspect) returns Boolean;
|
||||
---C++: alias operator==
|
||||
|
||||
IsNotEqual(me; Other : MarkerStyle from Aspect) returns Boolean;
|
||||
---C++: alias operator!=
|
||||
|
||||
----------------------------
|
||||
-- Category: Private methods
|
||||
----------------------------
|
||||
|
||||
SetPredefinedStyle ( me : in out ) is static private;
|
||||
---Level: Internal
|
||||
---Purpose: Set MyMarkerDescriptor with the predefined style values
|
||||
-- according of current type
|
||||
---Category: Private methods
|
||||
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
--
|
||||
-- Class : Aspect_MarkerStyle
|
||||
--
|
||||
-- Purpose : Declaration of variables specific to marker styles
|
||||
--
|
||||
|
||||
MyMarkerType : TypeOfMarker;
|
||||
MyXpoint : HArray1OfShortReal;
|
||||
MyYpoint : HArray1OfShortReal;
|
||||
MySpoint : HArray1OfBoolean;
|
||||
|
||||
end MarkerStyle;
|
567
src/Aspect/Aspect_MarkerStyle.cxx
Executable file
567
src/Aspect/Aspect_MarkerStyle.cxx
Executable file
@@ -0,0 +1,567 @@
|
||||
|
||||
// File Aspect_MarkerStyle.cxx
|
||||
// Created Janvier 1995
|
||||
// Author GG
|
||||
// Modified 23/02/98 : FMN ; Remplacement PI par Standard_PI
|
||||
// JR 02.01.100 : Implicit conversions
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux Type de markers
|
||||
|
||||
//-Warning Un style est definie, soit par son type predefini TOM_...
|
||||
// soit par sa description dans l'espace -1,+1
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_MarkerStyle.ixx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// MyMarkerType : TypeOfMarker from Aspect;
|
||||
// MyXpoint : Array1OfShortReal from TShort;
|
||||
// MyYpoint : Array1OfShortReal from TShort;
|
||||
// MySpoint : Array1OfBoolean from TColStd;
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_MarkerStyle::Aspect_MarkerStyle () : MyMarkerType(Aspect_TOM_POINT) {
|
||||
SetPredefinedStyle();
|
||||
}
|
||||
|
||||
Aspect_MarkerStyle::Aspect_MarkerStyle (
|
||||
const Aspect_TypeOfMarker aType) : MyMarkerType(aType) {
|
||||
SetPredefinedStyle();
|
||||
}
|
||||
|
||||
Aspect_MarkerStyle::Aspect_MarkerStyle (const TColStd_Array1OfReal& aXpoint,
|
||||
const TColStd_Array1OfReal& aYpoint)
|
||||
: MyMarkerType(Aspect_TOM_USERDEFINED) {
|
||||
Standard_Integer i,j=1;
|
||||
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,aXpoint.Length());
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,aXpoint.Length());
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,aXpoint.Length());
|
||||
|
||||
if( aXpoint.Length() != aYpoint.Length() ) {
|
||||
Aspect_MarkerStyleDefinitionError::Raise ("Bad Descriptor length") ;
|
||||
}
|
||||
|
||||
for( i=aXpoint.Lower() ; i<=aXpoint.Upper() ; i++,j++ ) {
|
||||
Standard_ShortReal X = (Standard_ShortReal ) aXpoint(i);
|
||||
Standard_ShortReal Y = (Standard_ShortReal ) aYpoint(i);
|
||||
if( X < -1. || X > 1. || Y < -1. || Y > 1. ) {
|
||||
Aspect_MarkerStyleDefinitionError::Raise ("Bad Descriptor value") ;
|
||||
}
|
||||
MyXpoint->SetValue(j,X);
|
||||
MyYpoint->SetValue(j,Y);
|
||||
MySpoint->SetValue(j,(j > 1) ? Standard_True : Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
Aspect_MarkerStyle::Aspect_MarkerStyle (const TColStd_Array1OfReal& aXpoint,
|
||||
const TColStd_Array1OfReal& aYpoint,
|
||||
const TColStd_Array1OfBoolean& aSpoint)
|
||||
: MyMarkerType(Aspect_TOM_USERDEFINED) {
|
||||
Standard_Integer i,j=1;
|
||||
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,aXpoint.Length());
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,aXpoint.Length());
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,aXpoint.Length());
|
||||
|
||||
if( (aXpoint.Length() != aYpoint.Length()) ||
|
||||
(aXpoint.Length() != aSpoint.Length()) ) {
|
||||
Aspect_MarkerStyleDefinitionError::Raise ("Bad Descriptor length") ;
|
||||
}
|
||||
|
||||
for( i=aXpoint.Lower() ; i<=aXpoint.Upper() ; i++,j++ ) {
|
||||
Standard_ShortReal X = (Standard_ShortReal ) aXpoint(i);
|
||||
Standard_ShortReal Y = (Standard_ShortReal ) aYpoint(i);
|
||||
Standard_Boolean S = aSpoint(i);
|
||||
if( X < -1. || X > 1. || Y < -1. || Y > 1. ) {
|
||||
Aspect_MarkerStyleDefinitionError::Raise ("Bad Descriptor value") ;
|
||||
}
|
||||
MyXpoint->SetValue(j,X);
|
||||
MyYpoint->SetValue(j,Y);
|
||||
MySpoint->SetValue(j,S);
|
||||
MySpoint->SetValue(j,(j > 1) ? S : Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
Aspect_MarkerStyle& Aspect_MarkerStyle::Assign (const Aspect_MarkerStyle& Other) {
|
||||
|
||||
MyMarkerType = Other.MyMarkerType ;
|
||||
MyXpoint = Other.MyXpoint ;
|
||||
MyYpoint = Other.MyYpoint ;
|
||||
MySpoint = Other.MySpoint ;
|
||||
|
||||
return (*this);
|
||||
|
||||
}
|
||||
|
||||
Aspect_TypeOfMarker Aspect_MarkerStyle::Type () const {
|
||||
|
||||
return MyMarkerType;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_MarkerStyle::Length () const {
|
||||
|
||||
return MyXpoint->Length();
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_MarkerStyle::Values (const Standard_Integer aRank,
|
||||
Standard_Real &X,Standard_Real &Y) const {
|
||||
|
||||
if( aRank < 1 || aRank > Length() ) {
|
||||
Aspect_MarkerStyleDefinitionError::Raise ("Bad Descriptor rank") ;
|
||||
}
|
||||
|
||||
X = MyXpoint->Value(aRank);
|
||||
Y = MyYpoint->Value(aRank);
|
||||
return MySpoint->Value(aRank);
|
||||
}
|
||||
|
||||
const TShort_Array1OfShortReal& Aspect_MarkerStyle::XValues () const {
|
||||
|
||||
return MyXpoint->Array1();
|
||||
}
|
||||
|
||||
const TShort_Array1OfShortReal& Aspect_MarkerStyle::YValues () const {
|
||||
|
||||
return MyYpoint->Array1();
|
||||
}
|
||||
|
||||
const TColStd_Array1OfBoolean& Aspect_MarkerStyle::SValues () const {
|
||||
|
||||
return MySpoint->Array1();
|
||||
}
|
||||
|
||||
#define MAX_O_POINT 12
|
||||
#define MAX_BALL_LINE 12
|
||||
#ifndef AIX
|
||||
#define FALSE Standard_False
|
||||
#define TRUE Standard_True
|
||||
#endif
|
||||
|
||||
void Aspect_MarkerStyle::SetPredefinedStyle() {
|
||||
|
||||
switch ( MyMarkerType ) {
|
||||
case Aspect_TOM_USERDEFINED :
|
||||
Aspect_MarkerStyleDefinitionError::Raise
|
||||
("Bad Marker Type Style");
|
||||
break;
|
||||
case Aspect_TOM_POINT :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,5) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,5) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,5) ;
|
||||
|
||||
MyXpoint->SetValue(1,-1.);
|
||||
MyYpoint->SetValue(1,-1.);
|
||||
MySpoint->SetValue(1,FALSE);
|
||||
|
||||
MyXpoint->SetValue(2,-1.);
|
||||
MyYpoint->SetValue(2,1.);
|
||||
MySpoint->SetValue(2,TRUE);
|
||||
|
||||
MyXpoint->SetValue(3,1.);
|
||||
MyYpoint->SetValue(3,1.);
|
||||
MySpoint->SetValue(3,TRUE);
|
||||
|
||||
MyXpoint->SetValue(4,1.);
|
||||
MyYpoint->SetValue(4,-1.);
|
||||
MySpoint->SetValue(4,TRUE);
|
||||
|
||||
MyXpoint->SetValue(5,-1.);
|
||||
MyYpoint->SetValue(5,-1.);
|
||||
MySpoint->SetValue(5,TRUE);
|
||||
break ;
|
||||
case Aspect_TOM_PLUS :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,4) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,4) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,4) ;
|
||||
|
||||
MyXpoint->SetValue(1, 0.);
|
||||
MyYpoint->SetValue(1,-1.);
|
||||
MySpoint->SetValue(1,FALSE);
|
||||
|
||||
MyXpoint->SetValue(2, 0.);
|
||||
MyYpoint->SetValue(2, 1.);
|
||||
MySpoint->SetValue(2,TRUE);
|
||||
|
||||
MyXpoint->SetValue(3,-1.);
|
||||
MyYpoint->SetValue(3, 0.);
|
||||
MySpoint->SetValue(3,FALSE);
|
||||
|
||||
MyXpoint->SetValue(4, 1.);
|
||||
MyYpoint->SetValue(4, 0.);
|
||||
MySpoint->SetValue(4,TRUE);
|
||||
break ;
|
||||
case Aspect_TOM_STAR :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,8) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,8) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,8) ;
|
||||
|
||||
MyXpoint->SetValue(1, 0.);
|
||||
MyYpoint->SetValue(1,-1.);
|
||||
MySpoint->SetValue(1,FALSE);
|
||||
|
||||
MyXpoint->SetValue(2, 0.);
|
||||
MyYpoint->SetValue(2, 1.);
|
||||
MySpoint->SetValue(2,TRUE);
|
||||
|
||||
MyXpoint->SetValue(3,-1.);
|
||||
MyYpoint->SetValue(3, 0.);
|
||||
MySpoint->SetValue(3,FALSE);
|
||||
|
||||
MyXpoint->SetValue(4, 1.);
|
||||
MyYpoint->SetValue(4, 0.);
|
||||
MySpoint->SetValue(4,TRUE);
|
||||
|
||||
MyXpoint->SetValue(5,(float ) -0.7);
|
||||
MyYpoint->SetValue(5,(float ) -0.7);
|
||||
MySpoint->SetValue(5,FALSE);
|
||||
|
||||
MyXpoint->SetValue(6,(float ) 0.7);
|
||||
MyYpoint->SetValue(6,(float ) 0.7);
|
||||
MySpoint->SetValue(6,TRUE);
|
||||
|
||||
MyXpoint->SetValue(7,(float ) 0.7);
|
||||
MyYpoint->SetValue(7,(float ) -0.7);
|
||||
MySpoint->SetValue(7,FALSE);
|
||||
|
||||
MyXpoint->SetValue(8,(float ) -0.7);
|
||||
MyYpoint->SetValue(8,(float ) 0.7);
|
||||
MySpoint->SetValue(8,TRUE);
|
||||
break ;
|
||||
case Aspect_TOM_O :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,MAX_O_POINT+1) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,MAX_O_POINT+1) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,MAX_O_POINT+1) ;
|
||||
|
||||
{ Standard_Integer i;
|
||||
Standard_Real da = 2.*Standard_PI/MAX_O_POINT;
|
||||
Standard_Real a = 0.;
|
||||
for( i=1 ; i<= MAX_O_POINT+1 ; i++,a += da ) {
|
||||
MyXpoint->SetValue(i,(float ) Cos(a));
|
||||
MyYpoint->SetValue(i,(float ) Sin(a));
|
||||
MySpoint->SetValue(i,(i > 1) ? TRUE : FALSE);
|
||||
}
|
||||
i = MAX_O_POINT+1;
|
||||
MyXpoint->SetValue(i,1.);
|
||||
MyYpoint->SetValue(i,0.);
|
||||
}
|
||||
break ;
|
||||
case Aspect_TOM_X :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,4) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,4) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,4) ;
|
||||
|
||||
MyXpoint->SetValue(1,(float ) -0.7);
|
||||
MyYpoint->SetValue(1,(float ) -0.7);
|
||||
MySpoint->SetValue(1,FALSE);
|
||||
|
||||
MyXpoint->SetValue(2,(float ) 0.7);
|
||||
MyYpoint->SetValue(2,(float ) 0.7);
|
||||
MySpoint->SetValue(2,TRUE);
|
||||
|
||||
MyXpoint->SetValue(3,(float ) 0.7);
|
||||
MyYpoint->SetValue(3,(float ) -0.7);
|
||||
MySpoint->SetValue(3,FALSE);
|
||||
|
||||
MyXpoint->SetValue(4,(float ) -0.7);
|
||||
MyYpoint->SetValue(4,(float ) 0.7);
|
||||
MySpoint->SetValue(4,TRUE);
|
||||
break ;
|
||||
case Aspect_TOM_O_POINT :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,MAX_O_POINT+6) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,MAX_O_POINT+6) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,MAX_O_POINT+6) ;
|
||||
{ Standard_Integer i;
|
||||
Standard_Real da = 2.*Standard_PI/MAX_O_POINT;
|
||||
Standard_Real a = 0.;
|
||||
for( i=1 ; i<= MAX_O_POINT+1 ; i++,a += da ) {
|
||||
MyXpoint->SetValue(i,(float ) Cos(a));
|
||||
MyYpoint->SetValue(i,(float ) Sin(a));
|
||||
MySpoint->SetValue(i,(i > 1) ? TRUE : FALSE);
|
||||
}
|
||||
i = MAX_O_POINT+1;
|
||||
MyXpoint->SetValue(i,1.);
|
||||
MyYpoint->SetValue(i,0.);
|
||||
|
||||
MyXpoint->SetValue(i+1,-0.25);
|
||||
MyYpoint->SetValue(i+1,-0.25);
|
||||
MySpoint->SetValue(i+1,FALSE);
|
||||
|
||||
MyXpoint->SetValue(i+2,-0.25);
|
||||
MyYpoint->SetValue(i+2,0.25);
|
||||
MySpoint->SetValue(i+2,TRUE);
|
||||
|
||||
MyXpoint->SetValue(i+3,0.25);
|
||||
MyYpoint->SetValue(i+3,0.25);
|
||||
MySpoint->SetValue(i+3,TRUE);
|
||||
|
||||
MyXpoint->SetValue(i+4,0.25);
|
||||
MyYpoint->SetValue(i+4,-0.25);
|
||||
MySpoint->SetValue(i+4,TRUE);
|
||||
|
||||
MyXpoint->SetValue(i+5,-0.25);
|
||||
MyYpoint->SetValue(i+5,-0.25);
|
||||
MySpoint->SetValue(i+5,TRUE);
|
||||
}
|
||||
break ;
|
||||
case Aspect_TOM_O_PLUS :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,MAX_O_POINT+5) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,MAX_O_POINT+5) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,MAX_O_POINT+5) ;
|
||||
|
||||
{ Standard_Integer i;
|
||||
Standard_Real da = 2.*Standard_PI/MAX_O_POINT;
|
||||
Standard_Real a = 0.;
|
||||
for( i=1 ; i<= MAX_O_POINT+1 ; i++,a += da ) {
|
||||
MyXpoint->SetValue(i,(float ) Cos(a));
|
||||
MyYpoint->SetValue(i,(float ) Sin(a));
|
||||
MySpoint->SetValue(i,(i > 1) ? TRUE : FALSE);
|
||||
}
|
||||
i = MAX_O_POINT+1;
|
||||
MyXpoint->SetValue(i,1.);
|
||||
MyYpoint->SetValue(i,0.);
|
||||
|
||||
MyXpoint->SetValue(i+1,0.);
|
||||
MyYpoint->SetValue(i+1,-0.5);
|
||||
MySpoint->SetValue(i+1,FALSE);
|
||||
|
||||
MyXpoint->SetValue(i+2,0.);
|
||||
MyYpoint->SetValue(i+2,0.5);
|
||||
MySpoint->SetValue(i+2,TRUE);
|
||||
|
||||
MyXpoint->SetValue(i+3,-0.5);
|
||||
MyYpoint->SetValue(i+3,0.);
|
||||
MySpoint->SetValue(i+3,FALSE);
|
||||
|
||||
MyXpoint->SetValue(i+4,0.5);
|
||||
MyYpoint->SetValue(i+4,0.);
|
||||
MySpoint->SetValue(i+4,TRUE);
|
||||
}
|
||||
break ;
|
||||
case Aspect_TOM_O_STAR :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,MAX_O_POINT+9) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,MAX_O_POINT+9) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,MAX_O_POINT+9) ;
|
||||
|
||||
{ Standard_Integer i;
|
||||
Standard_Real da = 2.*Standard_PI/MAX_O_POINT;
|
||||
Standard_Real a = 0.;
|
||||
for( i=1 ; i<= MAX_O_POINT+1 ; i++,a += da ) {
|
||||
MyXpoint->SetValue(i,(float ) Cos(a));
|
||||
MyYpoint->SetValue(i,(float ) Sin(a));
|
||||
MySpoint->SetValue(i,(i > 1) ? TRUE : FALSE);
|
||||
}
|
||||
i = MAX_O_POINT+1;
|
||||
MyXpoint->SetValue(i,1.);
|
||||
MyYpoint->SetValue(i,0.);
|
||||
|
||||
MyXpoint->SetValue(i+1, 0.);
|
||||
MyYpoint->SetValue(i+1,-0.5);
|
||||
MySpoint->SetValue(i+1,FALSE);
|
||||
|
||||
MyXpoint->SetValue(i+2, 0.);
|
||||
MyYpoint->SetValue(i+2,0.5);
|
||||
MySpoint->SetValue(i+2,TRUE);
|
||||
|
||||
MyXpoint->SetValue(i+3,-0.5);
|
||||
MyYpoint->SetValue(i+3, 0.);
|
||||
MySpoint->SetValue(i+3,FALSE);
|
||||
|
||||
MyXpoint->SetValue(i+4,0.5);
|
||||
MyYpoint->SetValue(i+4, 0.);
|
||||
MySpoint->SetValue(i+4,TRUE);
|
||||
|
||||
MyXpoint->SetValue(i+5,(float ) -0.35);
|
||||
MyYpoint->SetValue(i+5,(float ) -0.35);
|
||||
MySpoint->SetValue(i+5,FALSE);
|
||||
|
||||
MyXpoint->SetValue(i+6,(float ) 0.35);
|
||||
MyYpoint->SetValue(i+6,(float ) 0.35);
|
||||
MySpoint->SetValue(i+6,TRUE);
|
||||
|
||||
MyXpoint->SetValue(i+7,(float ) 0.35);
|
||||
MyYpoint->SetValue(i+7,(float ) -0.35);
|
||||
MySpoint->SetValue(i+7,FALSE);
|
||||
|
||||
MyXpoint->SetValue(i+8,(float ) -0.35);
|
||||
MyYpoint->SetValue(i+8,(float ) 0.35);
|
||||
MySpoint->SetValue(i+8,TRUE);
|
||||
}
|
||||
break ;
|
||||
case Aspect_TOM_O_X :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,MAX_O_POINT+5) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,MAX_O_POINT+5) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,MAX_O_POINT+5) ;
|
||||
|
||||
{ Standard_Integer i;
|
||||
Standard_Real da = 2.*Standard_PI/MAX_O_POINT;
|
||||
Standard_Real a = 0.;
|
||||
for( i=1 ; i<= MAX_O_POINT+1 ; i++,a += da ) {
|
||||
MyXpoint->SetValue(i,(float ) Cos(a));
|
||||
MyYpoint->SetValue(i,(float ) Sin(a));
|
||||
MySpoint->SetValue(i,(i > 1) ? TRUE : FALSE);
|
||||
}
|
||||
i = MAX_O_POINT+1;
|
||||
MyXpoint->SetValue(i,1.);
|
||||
MyYpoint->SetValue(i,0.);
|
||||
|
||||
MyXpoint->SetValue(i+1,(float ) -0.35);
|
||||
MyYpoint->SetValue(i+1,(float ) -0.35);
|
||||
MySpoint->SetValue(i+1,FALSE);
|
||||
|
||||
MyXpoint->SetValue(i+2,(float ) 0.35);
|
||||
MyYpoint->SetValue(i+2,(float ) 0.35);
|
||||
MySpoint->SetValue(i+2,TRUE);
|
||||
|
||||
MyXpoint->SetValue(i+3,(float ) 0.35);
|
||||
MyYpoint->SetValue(i+3,(float ) -0.35);
|
||||
MySpoint->SetValue(i+3,FALSE);
|
||||
|
||||
MyXpoint->SetValue(i+4,(float ) -0.35);
|
||||
MyYpoint->SetValue(i+4,(float ) 0.35);
|
||||
MySpoint->SetValue(i+4,TRUE);
|
||||
}
|
||||
break ;
|
||||
case Aspect_TOM_BALL :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,
|
||||
MAX_BALL_LINE*(MAX_O_POINT+1)) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,
|
||||
MAX_BALL_LINE*(MAX_O_POINT+1)) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,
|
||||
MAX_BALL_LINE*(MAX_O_POINT+1)) ;
|
||||
|
||||
{ Standard_Integer i,j,n = 0;
|
||||
Standard_Real da = 2.*Standard_PI/MAX_O_POINT;
|
||||
Standard_Real dr = 1./MAX_BALL_LINE;
|
||||
Standard_Real a,r = 1.;
|
||||
|
||||
for( i=1 ; i<= MAX_BALL_LINE ; i++ ) {
|
||||
a = 0.;
|
||||
for( j=1 ; j<= MAX_O_POINT+1 ; j++,a += da ) {
|
||||
n++;
|
||||
MyXpoint->SetValue(n,(float )( r*Cos(a)));
|
||||
MyYpoint->SetValue(n,(float )( r*Sin(a)));
|
||||
MySpoint->SetValue(n,(j > 1) ? TRUE : FALSE);
|
||||
}
|
||||
MyXpoint->SetValue(n,(float ) r);
|
||||
MyYpoint->SetValue(n,0.);
|
||||
r -= dr;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case Aspect_TOM_RING1 :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,
|
||||
(MAX_BALL_LINE/4)*(MAX_O_POINT+1)) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,
|
||||
(MAX_BALL_LINE/4)*(MAX_O_POINT+1)) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,
|
||||
(MAX_BALL_LINE/4)*(MAX_O_POINT+1)) ;
|
||||
|
||||
{ Standard_Integer i,j,n = 0;
|
||||
Standard_Real da = 2.*Standard_PI/MAX_O_POINT;
|
||||
Standard_Real dr = 1./MAX_BALL_LINE;
|
||||
Standard_Real a,r = 1.;
|
||||
|
||||
for( i=1 ; i<= MAX_BALL_LINE/4 ; i++ ) {
|
||||
a = 0.;
|
||||
for( j=1 ; j<= MAX_O_POINT+1 ; j++,a += da ) {
|
||||
n++;
|
||||
MyXpoint->SetValue(n,(float )( r*Cos(a)));
|
||||
MyYpoint->SetValue(n,(float )( r*Sin(a)));
|
||||
MySpoint->SetValue(n,(j > 1) ? TRUE : FALSE);
|
||||
}
|
||||
MyXpoint->SetValue(n,(float ) r);
|
||||
MyYpoint->SetValue(n,0.);
|
||||
r -= dr;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case Aspect_TOM_RING2 :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,
|
||||
(MAX_BALL_LINE/3)*(MAX_O_POINT+1)) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,
|
||||
(MAX_BALL_LINE/3)*(MAX_O_POINT+1)) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,
|
||||
(MAX_BALL_LINE/3)*(MAX_O_POINT+1)) ;
|
||||
|
||||
{ Standard_Integer i,j,n = 0;
|
||||
Standard_Real da = 2.*Standard_PI/MAX_O_POINT;
|
||||
Standard_Real dr = 1./MAX_BALL_LINE;
|
||||
Standard_Real a,r = 1.;
|
||||
|
||||
for( i=1 ; i<= MAX_BALL_LINE/3 ; i++ ) {
|
||||
a = 0.;
|
||||
for( j=1 ; j<= MAX_O_POINT+1 ; j++,a += da ) {
|
||||
n++;
|
||||
MyXpoint->SetValue(n,(float )( r*Cos(a)));
|
||||
MyYpoint->SetValue(n,(float )( r*Sin(a)));
|
||||
MySpoint->SetValue(n,(j > 1) ? TRUE : FALSE);
|
||||
}
|
||||
MyXpoint->SetValue(n,(float ) r);
|
||||
MyYpoint->SetValue(n,0.);
|
||||
r -= dr;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case Aspect_TOM_RING3 :
|
||||
MyXpoint = new TShort_HArray1OfShortReal(1,
|
||||
(MAX_BALL_LINE)/2*(MAX_O_POINT+1)) ;
|
||||
MyYpoint = new TShort_HArray1OfShortReal(1,
|
||||
(MAX_BALL_LINE)/2*(MAX_O_POINT+1)) ;
|
||||
MySpoint = new TColStd_HArray1OfBoolean(1,
|
||||
(MAX_BALL_LINE)/2*(MAX_O_POINT+1)) ;
|
||||
|
||||
{ Standard_Integer i,j,n = 0;
|
||||
Standard_Real da = 2.*Standard_PI/MAX_O_POINT;
|
||||
Standard_Real dr = 1./MAX_BALL_LINE;
|
||||
Standard_Real a,r = 1.;
|
||||
|
||||
for( i=1 ; i<= MAX_BALL_LINE/2 ; i++ ) {
|
||||
a = 0.;
|
||||
for( j=1 ; j<= MAX_O_POINT+1 ; j++,a += da ) {
|
||||
n++;
|
||||
MyXpoint->SetValue(n,(float )( r*Cos(a)));
|
||||
MyYpoint->SetValue(n,(float )( r*Sin(a)));
|
||||
MySpoint->SetValue(n,(j > 1) ? TRUE : FALSE);
|
||||
}
|
||||
MyXpoint->SetValue(n,(float ) r);
|
||||
MyYpoint->SetValue(n,0.);
|
||||
r -= dr;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_MarkerStyle::IsEqual(const Aspect_MarkerStyle& Other) const
|
||||
{
|
||||
return (
|
||||
(MyMarkerType == Other.MyMarkerType) &&
|
||||
(MyXpoint == Other.MyXpoint) &&
|
||||
(MyYpoint == Other.MyYpoint) &&
|
||||
(MySpoint == Other.MySpoint));
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_MarkerStyle::IsNotEqual(const Aspect_MarkerStyle& Other) const
|
||||
{
|
||||
return !IsEqual(Other);
|
||||
}
|
78
src/Aspect/Aspect_PixMap.cdl
Executable file
78
src/Aspect/Aspect_PixMap.cdl
Executable file
@@ -0,0 +1,78 @@
|
||||
--
|
||||
-- File: Aspect_PixMap.cdl
|
||||
-- Created: 14 October 1999
|
||||
-- Author: VKH
|
||||
-- Updated: GG IMP100701 Add the "depth" field and method
|
||||
-- to the pixmap object.
|
||||
|
||||
--
|
||||
---Copyright: MatraDatavision 1991,1992,1999
|
||||
|
||||
deferred class PixMap from Aspect
|
||||
inherits
|
||||
TShared from MMgt
|
||||
---Purpose: This class allows the definition of a pixmap(bitmap)
|
||||
|
||||
uses
|
||||
Handle from Aspect,
|
||||
Color from Quantity
|
||||
|
||||
raises
|
||||
PixmapDefinitionError from Aspect,
|
||||
PixmapError from Aspect
|
||||
is
|
||||
Initialize ( aWidth, anHeight : Integer from Standard;
|
||||
aDepth : Integer from Standard );
|
||||
---Level: Public
|
||||
---Purpose: Initializes the datas of a pixmap with a pixel size
|
||||
-- <aWidth>,<anHeight> and depth.
|
||||
|
||||
Destroy ( me : mutable )
|
||||
raises PixmapError from Aspect is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose: Destroy the pixmap
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
Dump ( me ; aFilename : CString from Standard;
|
||||
aGammaValue: Real from Standard = 1.0 )
|
||||
returns Boolean
|
||||
raises PixmapError from Aspect is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Dumps the Bitmap to an image file with
|
||||
-- an optional gamma correction value
|
||||
-- and returns TRUE if the dump occurs normaly.
|
||||
---Trigger: Raises if pixmap is not defined properly
|
||||
|
||||
PixelColor ( me : in;
|
||||
theX, theY : in Integer from Standard )
|
||||
returns Color from Quantity is deferred;
|
||||
---Purpose:
|
||||
-- Returns the pixel color.
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
PixmapID ( me ) returns Handle from Aspect
|
||||
is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose: Returns the ID of the just created pixmap
|
||||
---Category: Inquire methods
|
||||
|
||||
Size ( me ; aWidth, anHeight : out Integer from Standard )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the allocated pixmap's size in PIXEL
|
||||
---Category: Inquire methods
|
||||
|
||||
Depth ( me ) returns Integer from Standard
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the allocated pixmap's depth (planes number)
|
||||
---Category: Inquire methods
|
||||
fields
|
||||
myWidth : Integer from Standard is protected;
|
||||
myHeight : Integer from Standard is protected;
|
||||
myDepth : Integer from Standard is protected;
|
||||
end PixMap;
|
37
src/Aspect/Aspect_PixMap.cxx
Executable file
37
src/Aspect/Aspect_PixMap.cxx
Executable file
@@ -0,0 +1,37 @@
|
||||
|
||||
// File Aspect_PixMap.cxx
|
||||
// Created 14 October 1999
|
||||
// Author VKH
|
||||
// Updated GG IMP100701 Add the "depth" field and method
|
||||
// to the pixmap object.
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992,1999
|
||||
|
||||
//-Version
|
||||
|
||||
//
|
||||
#include <Aspect_PixMap.ixx>
|
||||
|
||||
//-Constructor
|
||||
////////////////////////////////////////////////////////////////////
|
||||
Aspect_PixMap::Aspect_PixMap ( const Standard_Integer aWidth,
|
||||
const Standard_Integer anHeight,
|
||||
const Standard_Integer aDepth )
|
||||
{
|
||||
myWidth = aWidth;
|
||||
myHeight = anHeight;
|
||||
myDepth = aDepth;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void Aspect_PixMap::Size ( Standard_Integer &aWidth,
|
||||
Standard_Integer &anHeight ) const {
|
||||
aWidth = myWidth;
|
||||
anHeight = myHeight;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Standard_Integer Aspect_PixMap::Depth () const {
|
||||
return myDepth;
|
||||
}
|
||||
|
27
src/Aspect/Aspect_Pixel.cdl
Executable file
27
src/Aspect/Aspect_Pixel.cdl
Executable file
@@ -0,0 +1,27 @@
|
||||
--
|
||||
-- File: Aspect_Pixel.cdl
|
||||
-- Created: 23/03/93
|
||||
-- Author: BBL
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
deferred class Pixel from Aspect inherits Storable
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a Pixel.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
is
|
||||
|
||||
Initialize;
|
||||
---Level: Public
|
||||
|
||||
Print( me ; s : in out OStream ) is deferred ;
|
||||
---Level: Public
|
||||
---Purpose : Prints the contents of <me> on the stream <s>
|
||||
---C++: alias "friend Standard_EXPORT Standard_OStream& operator << (Standard_OStream&,const Aspect_Pixel& );"
|
||||
|
||||
end Pixel from Aspect;
|
11
src/Aspect/Aspect_Pixel.cxx
Executable file
11
src/Aspect/Aspect_Pixel.cxx
Executable file
@@ -0,0 +1,11 @@
|
||||
#include <Aspect_Pixel.ixx>
|
||||
#include <Standard_OStream.hxx>
|
||||
|
||||
Aspect_Pixel::Aspect_Pixel() {}
|
||||
|
||||
Standard_OStream& operator << (Standard_OStream& s, const Aspect_Pixel& aPixel)
|
||||
{
|
||||
aPixel.Print( s ) ;
|
||||
return s ;
|
||||
}
|
||||
|
26
src/Aspect/Aspect_PolygonOffsetMode.hxx
Executable file
26
src/Aspect/Aspect_PolygonOffsetMode.hxx
Executable file
@@ -0,0 +1,26 @@
|
||||
/* File: Aspect_PolygonOffsetMode.hxx
|
||||
* Created: 3/22/2004 15:55:39
|
||||
* Author: Sergey ANIKIN
|
||||
* Copyright: Open CASCADE 2004
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created: 22/03/04 ; SAN : OCC4895 High-level interface for controlling polygon offsets
|
||||
*/
|
||||
|
||||
#ifndef ASPECT_POLYGONOFFSETMODE_HEADER
|
||||
#define ASPECT_POLYGONOFFSETMODE_HEADER
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Aspect_POM_Off = 0x00, /* all polygon offset modes disabled */
|
||||
Aspect_POM_Fill = 0x01, /* GL_POLYGON_OFFSET_FILL enabled (shaded polygons) */
|
||||
Aspect_POM_Line = 0x02, /* GL_POLYGON_OFFSET_LINE enabled (polygons as outlines) */
|
||||
Aspect_POM_Point = 0x04, /* GL_POLYGON_OFFSET_POINT enabled (polygons as vertices)*/
|
||||
Aspect_POM_All = Aspect_POM_Fill | Aspect_POM_Line | Aspect_POM_Point,
|
||||
Aspect_POM_None = 0x08, /* do not change current polygon offset mode */
|
||||
Aspect_POM_Mask = Aspect_POM_All | Aspect_POM_None
|
||||
} Aspect_PolygonOffsetMode;
|
||||
|
||||
#endif
|
||||
|
13
src/Aspect/Aspect_RGBPixel.cxx
Executable file
13
src/Aspect/Aspect_RGBPixel.cxx
Executable file
@@ -0,0 +1,13 @@
|
||||
// File: Aspect_RGBPixel.cxx
|
||||
// Created: 28-OCT-98
|
||||
// Author: DCB
|
||||
// Copyright: MatraDatavision 1998
|
||||
|
||||
#include <Aspect_RGBPixel.hxx>
|
||||
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_RGBPixel)
|
||||
{
|
||||
static Handle(Standard_Type) _atype =
|
||||
new Standard_Type("Aspect_RGBPixel",sizeof(Aspect_RGBPixel));
|
||||
return _atype;
|
||||
}
|
13
src/Aspect/Aspect_RGBPixel.hxx
Executable file
13
src/Aspect/Aspect_RGBPixel.hxx
Executable file
@@ -0,0 +1,13 @@
|
||||
#ifndef _Aspect_RGBPixel_HeaderFile
|
||||
#define _Aspect_RGBPixel_HeaderFile
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
typedef struct {
|
||||
float red;
|
||||
float green;
|
||||
float blue;
|
||||
} Aspect_RGBPixel;
|
||||
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_RGBPixel);
|
||||
|
||||
#endif
|
112
src/Aspect/Aspect_RectangularGrid.cdl
Executable file
112
src/Aspect/Aspect_RectangularGrid.cdl
Executable file
@@ -0,0 +1,112 @@
|
||||
-- File: Aspect_RectangularGrid.cdl
|
||||
-- Created: Thu Mar 2 14:23:42 1995
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@pernox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
class RectangularGrid from Aspect
|
||||
inherits Grid from Aspect
|
||||
|
||||
uses
|
||||
PlaneAngle, Length from Quantity
|
||||
|
||||
raises
|
||||
NegativeValue,NullValue,NumericError from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(aXStep, aYStep: Length from Quantity;
|
||||
anXOrigin: Length from Quantity = 0;
|
||||
anYOrigin: Length from Quantity = 0;
|
||||
aFirstAngle: PlaneAngle from Quantity = 0;
|
||||
aSecondAngle: PlaneAngle from Quantity = 0;
|
||||
aRotationAngle: PlaneAngle from Quantity = 0)
|
||||
returns mutable RectangularGrid from Aspect
|
||||
---Purpose: creates a new grid. By default this grid is not
|
||||
-- active.
|
||||
-- The first angle is given relatively to the horizontal.
|
||||
-- The second angle is given relatively to the vertical.
|
||||
raises NumericError from Standard;
|
||||
---Warning: raises NumericError from Standard if the two
|
||||
-- networks are parallel.
|
||||
|
||||
---Category: grid definition methods
|
||||
|
||||
|
||||
SetXStep(me: mutable; aStep: Length from Quantity)
|
||||
---Purpose: defines the x step of the grid.
|
||||
raises NegativeValue,NullValue from Standard
|
||||
---Warning: raises an exception is the step is not strictly positive.
|
||||
is static;
|
||||
|
||||
SetYStep(me: mutable; aStep: Length from Quantity)
|
||||
---Purpose: defines the y step of the grid.
|
||||
raises NegativeValue,NullValue from Standard
|
||||
---Warning: raises an exception is the step is not strictly positive.
|
||||
is static;
|
||||
|
||||
SetAngle(me: mutable; anAngle1: PlaneAngle from Quantity;
|
||||
anAngle2: PlaneAngle from Quantity)
|
||||
---Purpose: defines the angle of the second network
|
||||
-- the fist angle is given relatively to the horizontal.
|
||||
-- the second angle is given relatively to the vertical.
|
||||
raises NumericError from Standard
|
||||
---Warning: raises NumericError from Standard if the two
|
||||
-- line networks are parallel.
|
||||
is static;
|
||||
|
||||
SetGridValues(me: mutable; XOrigin, YOrigin: Length from Quantity;
|
||||
XStep, YStep: Length from Quantity;
|
||||
RotationAngle: PlaneAngle from Quantity)
|
||||
is static;
|
||||
|
||||
---Category: Pick methods
|
||||
--
|
||||
Compute(me; X,Y: Length from Quantity; gridX, gridY : out Length from Quantity)
|
||||
---Purpose: returns the point of the grid the closest to the point X,Y
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
---Category: inquire methods
|
||||
|
||||
XStep(me) returns Length from Quantity
|
||||
---Purpose: returns the x step of the grid.
|
||||
is static;
|
||||
|
||||
YStep(me) returns Length from Quantity
|
||||
---Purpose: returns the x step of the grid.
|
||||
is static;
|
||||
|
||||
FirstAngle(me) returns PlaneAngle from Quantity
|
||||
---Purpose: returns the x Angle of the grid, relatively to the horizontal.
|
||||
is static;
|
||||
|
||||
SecondAngle(me) returns PlaneAngle from Quantity
|
||||
---Purpose: returns the y Angle of the grid, relatively to the vertical.
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
|
||||
---Category: private methods.
|
||||
|
||||
|
||||
Init(me: mutable)
|
||||
is redefined static;
|
||||
|
||||
CheckAngle(me;alpha,beta: PlaneAngle from Quantity)
|
||||
returns Boolean from Standard
|
||||
is static private;
|
||||
|
||||
fields
|
||||
|
||||
myXStep: Length from Quantity;
|
||||
myYStep: Length from Quantity;
|
||||
myFirstAngle: PlaneAngle from Quantity;
|
||||
mySecondAngle: PlaneAngle from Quantity;
|
||||
a1,b1,c1: Real from Standard;
|
||||
a2,b2,c2: Real from Standard;
|
||||
|
||||
|
||||
end RectangularGrid from Aspect;
|
169
src/Aspect/Aspect_RectangularGrid.cxx
Executable file
169
src/Aspect/Aspect_RectangularGrid.cxx
Executable file
@@ -0,0 +1,169 @@
|
||||
// Modified 23/02/98 : FMN ; Remplacement PI par Standard_PI
|
||||
|
||||
#define CSR577 //GG 25/09/00 Avoid to have unaccuracy coordinates computation
|
||||
// when the grid is activated.
|
||||
|
||||
#define xTRACE
|
||||
|
||||
#include <Aspect_RectangularGrid.ixx>
|
||||
|
||||
|
||||
Aspect_RectangularGrid::Aspect_RectangularGrid(
|
||||
const Quantity_Length aXStep,
|
||||
const Quantity_Length aYStep,
|
||||
const Quantity_Length anXOrigin,
|
||||
const Quantity_Length anYOrigin,
|
||||
const Quantity_PlaneAngle aFirstAngle,
|
||||
const Quantity_PlaneAngle aSecondAngle,
|
||||
const Quantity_PlaneAngle aRotationAngle)
|
||||
:Aspect_Grid(anXOrigin,anYOrigin,aRotationAngle),myXStep(aXStep),myYStep(aYStep),myFirstAngle(aFirstAngle),mySecondAngle(aSecondAngle)
|
||||
|
||||
{
|
||||
Standard_NumericError_Raise_if(!CheckAngle (aFirstAngle,mySecondAngle),
|
||||
"networks are parallel");
|
||||
|
||||
Standard_NegativeValue_Raise_if(aXStep < 0. , "invalid x step");
|
||||
Standard_NegativeValue_Raise_if(aYStep < 0. , "invalid y step");
|
||||
Standard_NullValue_Raise_if(aXStep == 0. , "invalid x step");
|
||||
Standard_NullValue_Raise_if(aYStep == 0. , "invalid y step");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Aspect_RectangularGrid::SetXStep(const Quantity_Length aStep) {
|
||||
Standard_NegativeValue_Raise_if(aStep < 0. , "invalid x step");
|
||||
Standard_NullValue_Raise_if(aStep == 0. , "invalid y step");
|
||||
myXStep = aStep;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void Aspect_RectangularGrid::SetYStep(const Quantity_Length aStep) {
|
||||
Standard_NegativeValue_Raise_if(aStep < 0. , "invalid x step");
|
||||
Standard_NullValue_Raise_if(aStep == 0. , "invalid y step");
|
||||
myYStep = aStep;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void Aspect_RectangularGrid::SetAngle(const Quantity_PlaneAngle anAngle1,
|
||||
const Quantity_PlaneAngle anAngle2){
|
||||
|
||||
Standard_NumericError_Raise_if(!CheckAngle (anAngle1,anAngle2 ),
|
||||
"axis are parallel");
|
||||
myFirstAngle = anAngle1;
|
||||
mySecondAngle = anAngle2;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void Aspect_RectangularGrid::SetGridValues(
|
||||
const Quantity_Length theXOrigin,
|
||||
const Quantity_Length theYOrigin,
|
||||
const Quantity_Length theXStep,
|
||||
const Quantity_Length theYStep,
|
||||
const Quantity_PlaneAngle theRotationAngle) {
|
||||
|
||||
myXOrigin = theXOrigin;
|
||||
myYOrigin = theYOrigin;
|
||||
Standard_NegativeValue_Raise_if(theXStep < 0. , "invalid x step");
|
||||
Standard_NullValue_Raise_if(theXStep == 0. , "invalid x step");
|
||||
myXStep = theXStep;
|
||||
Standard_NegativeValue_Raise_if(theYStep < 0. , "invalid y step");
|
||||
Standard_NullValue_Raise_if(theYStep == 0. , "invalid y step");
|
||||
myYStep = theYStep;
|
||||
myRotationAngle = theRotationAngle;
|
||||
Init();
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void Aspect_RectangularGrid::Compute(const Quantity_Length X,
|
||||
const Quantity_Length Y,
|
||||
Quantity_Length& gridX,
|
||||
Quantity_Length& gridY) const {
|
||||
Standard_Real D1 = b1 * X - a1 * Y - c1;
|
||||
Standard_Real D2 = b2 * X - a2 * Y - c2;
|
||||
Standard_Integer n1 = Standard_Integer ( Abs(D1)/myXStep + 0.5);
|
||||
Standard_Integer n2 = Standard_Integer ( Abs(D2)/myYStep + 0.5);
|
||||
Standard_Real offset1 = c1 + Standard_Real(n1) * Sign (myXStep , D1);
|
||||
Standard_Real offset2 = c2 + Standard_Real(n2) * Sign (myYStep , D2);
|
||||
#ifdef CSR577
|
||||
Standard_Real Delta = a1*b2 - b1*a2;
|
||||
gridX = ( offset2*a1 - offset1*a2) /Delta;
|
||||
gridY = ( offset2*b1 - offset1*b2) /Delta;
|
||||
#else
|
||||
Standard_Real Delta = b1*a2 - a1*b2;
|
||||
gridX = ( offset1*a2 - offset2*a1) /Delta;
|
||||
gridY = ( offset1*b2 - offset2*b1) /Delta;
|
||||
#endif
|
||||
#ifdef TRACE
|
||||
cout << "Aspect_RectangularGrid::Compute (" << Quantity_Length (X) << ", "
|
||||
<< Quantity_Length (Y) << ", " << Quantity_Length (gridX) << ", "
|
||||
<< Quantity_Length (gridY) << ")" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
Quantity_Length Aspect_RectangularGrid::XStep() const {
|
||||
return myXStep;
|
||||
}
|
||||
|
||||
Quantity_Length Aspect_RectangularGrid::YStep() const {
|
||||
return myYStep;
|
||||
}
|
||||
|
||||
Quantity_Length Aspect_RectangularGrid::FirstAngle() const {
|
||||
return myFirstAngle;
|
||||
}
|
||||
|
||||
Quantity_Length Aspect_RectangularGrid::SecondAngle() const {
|
||||
return mySecondAngle;
|
||||
}
|
||||
|
||||
void Aspect_RectangularGrid::Init () {
|
||||
|
||||
//+zov Fixing CTS17856
|
||||
// a1 = Cos (myFirstAngle + RotationAngle() );
|
||||
// b1 = Sin (myFirstAngle + RotationAngle() );
|
||||
// c1 = XOrigin() * b1 - YOrigin() * a1;
|
||||
//
|
||||
// a2 = Cos (mySecondAngle + RotationAngle() + Standard_PI/2.);
|
||||
// b2 = Sin (mySecondAngle + RotationAngle() + Standard_PI/2.);
|
||||
// c2 = XOrigin() * b2 - YOrigin() * a2;
|
||||
|
||||
#ifdef CSR577
|
||||
Standard_Real angle1 = myFirstAngle + RotationAngle();
|
||||
Standard_Real angle2 = mySecondAngle + RotationAngle();
|
||||
if ( angle1 != 0. ) {
|
||||
a1 = -Sin (angle1);
|
||||
b1 = Cos (angle1);
|
||||
c1 = XOrigin() * b1 - YOrigin() * a1;
|
||||
} else {
|
||||
a1 = 0.; b1 = 1.; c1 = XOrigin();
|
||||
}
|
||||
|
||||
if ( angle2 != 0. ) {
|
||||
angle2 += Standard_PI/2.;
|
||||
a2 = -Sin (angle2);
|
||||
b2 = Cos (angle2);
|
||||
c2 = XOrigin() * b2 - YOrigin() * a2;
|
||||
} else {
|
||||
a2 = -1.; b2 = 0.; c2 = YOrigin();
|
||||
}
|
||||
#else
|
||||
a1 = -Sin (myFirstAngle + RotationAngle());
|
||||
b1 = Cos (myFirstAngle + RotationAngle());
|
||||
c1 = XOrigin() * b1 - YOrigin() * a1;
|
||||
|
||||
a2 = -Sin (mySecondAngle + RotationAngle() + Standard_PI/2.);
|
||||
b2 = Cos (mySecondAngle + RotationAngle() + Standard_PI/2.);
|
||||
c2 = XOrigin() * b2 - YOrigin() * a2;
|
||||
#endif
|
||||
//-zov
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_RectangularGrid::CheckAngle(const Standard_Real alpha,
|
||||
const Standard_Real beta) const {
|
||||
return Abs( Sin(alpha)*Cos(beta+Standard_PI/2.) - Cos(alpha)*Sin(beta+Standard_PI/2.) != 0) ;
|
||||
}
|
||||
|
||||
|
24
src/Aspect/Aspect_RenderingContext.hxx
Executable file
24
src/Aspect/Aspect_RenderingContext.hxx
Executable file
@@ -0,0 +1,24 @@
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Aspect_RenderingContext.hxx */
|
||||
/*==== Role : The header file of primitive type "RenderingContext" from package */
|
||||
/*==== "V3d" */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
/*============================================================================*/
|
||||
|
||||
#ifndef _Aspect_RenderingContext_HeaderFile
|
||||
#define _Aspect_RenderingContext_HeaderFile
|
||||
|
||||
typedef void* Aspect_RenderingContext; /* GLXContext under UNIX */
|
||||
/* HGLRC under WNT */
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
/*==== Definition de Type ====================================================*/
|
||||
|
||||
#include <Standard_Macro.hxx>
|
||||
class Handle(Standard_Type);
|
||||
const Handle(Standard_Type)& STANDARD_TYPE(Aspect_RenderingContext);
|
||||
|
||||
/*============================================================================*/
|
||||
#endif
|
||||
|
||||
#endif /* _Aspect_RenderingContext_HeaderFile */
|
69
src/Aspect/Aspect_TypeMap.cdl
Executable file
69
src/Aspect/Aspect_TypeMap.cdl
Executable file
@@ -0,0 +1,69 @@
|
||||
--
|
||||
-- File: Aspect_TypeMap.cdl
|
||||
-- Created: 07/09/93
|
||||
-- Author: GG
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
class TypeMap from Aspect inherits TShared from MMgt
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a TypeMap object.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
uses
|
||||
LineStyle from Aspect,
|
||||
TypeMapEntry from Aspect,
|
||||
SequenceOfTypeMapEntry from Aspect
|
||||
|
||||
raises
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
Create returns mutable TypeMap from Aspect;
|
||||
|
||||
AddEntry (me : mutable; AnEntry : TypeMapEntry from Aspect)
|
||||
---Level: Public
|
||||
---Purpose: Adds an entry in the type map <me>.
|
||||
-- Warning: Raises BadAccess if TypeMap size is exceeded.
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
AddEntry (me : mutable; aStyle : LineStyle from Aspect)
|
||||
returns Integer from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Search an identical type style entry in the type map <me>
|
||||
-- and returns the TypeMapEntry Index if exist.
|
||||
-- Or add a new entry and returns the computed TypeMapEntry index used.
|
||||
|
||||
Size( me ) returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Allocated typemap Size
|
||||
|
||||
Index( me ; aTypemapIndex : Integer ) returns Integer from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the TypeMapEntry.Index of the TypeMap
|
||||
-- at rank <aTypemapIndex> .
|
||||
raises BadAccess from Aspect is static;
|
||||
---Trigger: Raises BadAccess if the index less than 1 or
|
||||
-- greater than Size.
|
||||
|
||||
Dump( me ) ;
|
||||
|
||||
Entry ( me ;
|
||||
AnIndex : Integer from Standard )
|
||||
returns TypeMapEntry from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Returns the Type map entry with the index <AnIndex>.
|
||||
-- Warning: Raises BadAccess if the index less than 1 or
|
||||
-- greater than Size.
|
||||
raises BadAccess from Aspect is static;
|
||||
---C++: return const &
|
||||
|
||||
fields
|
||||
|
||||
mydata : SequenceOfTypeMapEntry from Aspect is protected;
|
||||
|
||||
end TypeMap ;
|
106
src/Aspect/Aspect_TypeMap.cxx
Executable file
106
src/Aspect/Aspect_TypeMap.cxx
Executable file
@@ -0,0 +1,106 @@
|
||||
// File Aspect_TypeMap.cxx
|
||||
// Created Septembre 1993
|
||||
// Author GG
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux Ensembles
|
||||
// de Type de traits
|
||||
|
||||
//-Warning Une TypeMap est definie par un ensemble de TypeMapEntries
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_TypeMap.ixx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// mydata : SequenceOfTypeMapEntry from Aspect is protected
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_TypeMap::Aspect_TypeMap( ) {
|
||||
Aspect_TypeMapEntry theDefaultEntry;
|
||||
|
||||
AddEntry(theDefaultEntry);
|
||||
}
|
||||
|
||||
void Aspect_TypeMap::AddEntry (const Aspect_TypeMapEntry& AnEntry) {
|
||||
Standard_Integer i,index = AnEntry.Index();
|
||||
Aspect_TypeMapEntry theEntry;
|
||||
|
||||
for( i=1 ; i<=mydata.Length() ; i++ ) {
|
||||
theEntry = mydata.Value(i);
|
||||
if( index == theEntry.Index() ) break;
|
||||
}
|
||||
|
||||
if( i > mydata.Length() ) {
|
||||
mydata.Append( AnEntry );
|
||||
} else {
|
||||
mydata.SetValue(i,AnEntry);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_TypeMap::AddEntry (const Aspect_LineStyle &aStyle) {
|
||||
Aspect_TypeMapEntry theEntry ;
|
||||
Standard_Integer i,maxindex = 0 ;
|
||||
|
||||
for( i=1 ; i<=mydata.Length() ; i++ ) {
|
||||
theEntry = mydata.Value(i) ;
|
||||
maxindex = Max(maxindex,theEntry.Index()) ;
|
||||
if( theEntry.Type() == aStyle ) return theEntry.Index() ;
|
||||
}
|
||||
|
||||
maxindex++ ;
|
||||
theEntry.SetValue(maxindex,aStyle) ;
|
||||
mydata.Append( theEntry ) ;
|
||||
return maxindex ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_TypeMap::Size() const {
|
||||
|
||||
return mydata.Length() ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_TypeMap::Index(const Standard_Integer anIndex) const {
|
||||
|
||||
if( anIndex < 1 || anIndex > Size() ) {
|
||||
Aspect_BadAccess::Raise ("Undefined typemap Index");
|
||||
}
|
||||
|
||||
Aspect_TypeMapEntry theEntry = mydata.Value(anIndex) ;
|
||||
|
||||
return theEntry.Index() ;
|
||||
}
|
||||
|
||||
const Aspect_TypeMapEntry& Aspect_TypeMap::Entry (const Standard_Integer AnIndex) const {
|
||||
|
||||
if( AnIndex < 1 || AnIndex > mydata.Length() )
|
||||
Aspect_BadAccess::Raise ("Aspect_TypeMap::Entry Bad Index");
|
||||
|
||||
return mydata.Value(AnIndex);
|
||||
}
|
||||
|
||||
void Aspect_TypeMap::Dump () const {
|
||||
|
||||
Standard_Integer i ;
|
||||
|
||||
cout << "Typemap Dump-->\n" ;
|
||||
|
||||
for ( i = 1 ; i <= Size() ; i++ ) (Entry(i)).Dump() ;
|
||||
|
||||
cout << "<--End Typemap Dump\n" ;
|
||||
}
|
95
src/Aspect/Aspect_TypeMapEntry.cdl
Executable file
95
src/Aspect/Aspect_TypeMapEntry.cdl
Executable file
@@ -0,0 +1,95 @@
|
||||
|
||||
--
|
||||
-- File: Aspect_TypeMapEntry.cdl
|
||||
-- Created: 07/09/93
|
||||
-- Author: GG
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
class TypeMapEntry from Aspect
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a typemap entry.
|
||||
-- A typemap entry is an association between
|
||||
-- a LineStyle object and an index in the typemap.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
LineStyle from Aspect
|
||||
|
||||
raises
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
Create
|
||||
returns TypeMapEntry from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates an unallocated typemap entry
|
||||
|
||||
Create ( index : Integer from Standard;
|
||||
style : LineStyle from Aspect)
|
||||
returns TypeMapEntry;
|
||||
---Level: Public
|
||||
---Purpose: Creates an allocated typemap entry
|
||||
|
||||
Create ( entry : TypeMapEntry from Aspect )
|
||||
returns TypeMapEntry
|
||||
---Level: Public
|
||||
---Purpose: Creates an allocated typemap entry.
|
||||
-- Warning: Raises error if the typemap entry <entry>
|
||||
-- is unallocated.
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
SetValue ( me: in out; index : Integer from Standard;
|
||||
style : LineStyle from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Sets typemap entry value and allocates it.
|
||||
|
||||
SetValue ( me: in out; entry : TypeMapEntry from Aspect);
|
||||
---Level: Public
|
||||
---Purpose: Sets typemap entry value and allocates it.
|
||||
---C++: alias operator =
|
||||
|
||||
SetType ( me: in out; Style : LineStyle from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Sets the line style of typemap entry.
|
||||
|
||||
Type ( me ) returns LineStyle from Aspect
|
||||
---Warning: Raises error if the typemap entry is unallocated .
|
||||
raises BadAccess from Aspect;
|
||||
---C++: return const &
|
||||
|
||||
SetIndex ( me: in out; index : Integer from Standard);
|
||||
---Level: Public
|
||||
---Purpose: Sets index value of a typemap entry.
|
||||
|
||||
Index ( me ) returns Integer from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns index value of a typemap entry.
|
||||
-- Warning: Raises error if the typemap entry is unallocated .
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
Free ( me : in out );
|
||||
---Level: Public
|
||||
---Purpose: Unallocates the typemap entry.
|
||||
|
||||
IsAllocated ( me ) returns Boolean from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns True if the typemap entry is allocated.
|
||||
-- Warning: A typemap entry is allocated when the type and
|
||||
-- the index is defined.
|
||||
|
||||
Dump( me ) ;
|
||||
---Level: Internal
|
||||
|
||||
fields
|
||||
MyType : LineStyle from Aspect;
|
||||
MyIndex : Integer from Standard;
|
||||
MyTypeIsDef : Boolean from Standard;
|
||||
MyIndexIsDef : Boolean from Standard;
|
||||
|
||||
end TypeMapEntry from Aspect;
|
152
src/Aspect/Aspect_TypeMapEntry.cxx
Executable file
152
src/Aspect/Aspect_TypeMapEntry.cxx
Executable file
@@ -0,0 +1,152 @@
|
||||
|
||||
// File Aspect_TypeMapEntry.cxx
|
||||
// Created Septembre 1993
|
||||
// Author GG
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux Entries de
|
||||
// Types de trait
|
||||
|
||||
//-Warning Une entry est definie par un index associee a un Line style
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_TypeMapEntry.ixx>
|
||||
#include <TColQuantity_Array1OfLength.hxx>
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
// MyType : LineStyle from Aspect
|
||||
// MyIndex : Integer from Standard
|
||||
// MyTypeIsDef : Boolean from Standard
|
||||
// MyIndexIsDef : Boolean from Standard
|
||||
|
||||
//-Constructors
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Aspect_TypeMapEntry::Aspect_TypeMapEntry() {
|
||||
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = 0;
|
||||
MyType.SetValues (Aspect_TOL_SOLID);
|
||||
|
||||
}
|
||||
|
||||
Aspect_TypeMapEntry::Aspect_TypeMapEntry (const Standard_Integer index, const Aspect_LineStyle &style) {
|
||||
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
MyType = style;
|
||||
|
||||
}
|
||||
|
||||
Aspect_TypeMapEntry::Aspect_TypeMapEntry (const Aspect_TypeMapEntry& entry) {
|
||||
|
||||
if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
|
||||
Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;
|
||||
}
|
||||
else {
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = entry.MyIndex;
|
||||
MyType = entry.MyType;
|
||||
}
|
||||
}
|
||||
|
||||
void Aspect_TypeMapEntry::SetValue (const Standard_Integer index, const Aspect_LineStyle &style) {
|
||||
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
MyType = style;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_TypeMapEntry::SetValue (const Aspect_TypeMapEntry& entry) {
|
||||
|
||||
if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
|
||||
Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;
|
||||
}
|
||||
else {
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = entry.MyIndex;
|
||||
MyType = entry.MyType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Aspect_TypeMapEntry::SetType (const Aspect_LineStyle &style) {
|
||||
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyType = style;
|
||||
|
||||
}
|
||||
|
||||
const Aspect_LineStyle& Aspect_TypeMapEntry::Type () const {
|
||||
|
||||
if ( !MyTypeIsDef || !MyIndexIsDef )
|
||||
Aspect_BadAccess::Raise("Unallocated TypeMapEntry") ;
|
||||
|
||||
return MyType;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_TypeMapEntry::SetIndex (const Standard_Integer index) {
|
||||
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_TypeMapEntry::Index () const {
|
||||
|
||||
if ( !MyTypeIsDef || !MyIndexIsDef )
|
||||
Aspect_BadAccess::Raise("Unallocated TypeMapEntry");
|
||||
|
||||
return MyIndex;
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_TypeMapEntry::IsAllocated () const {
|
||||
|
||||
return ( MyTypeIsDef && MyIndexIsDef ) ;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_TypeMapEntry::Free () {
|
||||
|
||||
MyTypeIsDef = Standard_False;
|
||||
MyIndexIsDef = Standard_False;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_TypeMapEntry::Dump () const {
|
||||
|
||||
Aspect_TypeOfLine style = MyType.Style() ;
|
||||
Standard_Integer i,length = MyType.Length() ;
|
||||
|
||||
cout << " Aspect_TypeMapEntry::Dump ()\n";
|
||||
cout << " MyTypeIsDef : " << (MyTypeIsDef) ? "True\n" : "False\n";
|
||||
cout << " MyIndexIsDef : " << (MyIndexIsDef) ? "True\n" : "False\n";
|
||||
cout << " LineStyle : " << (Standard_Integer) style << " Length : " << length << "\n";//WNT
|
||||
if( length ) {
|
||||
for( i=(MyType.Values()).Lower() ; i<=(MyType.Values()).Upper() ; i++ )
|
||||
cout << "\t\tvalue(" << i << ") : " << MyType.Values().Value(i) << "\n";
|
||||
}
|
||||
cout << flush;
|
||||
}
|
24
src/Aspect/Aspect_Units.hxx
Executable file
24
src/Aspect/Aspect_Units.hxx
Executable file
@@ -0,0 +1,24 @@
|
||||
|
||||
#ifndef _Aspect_Units_HeaderFile
|
||||
#define _Aspect_Units_HeaderFile
|
||||
|
||||
/*
|
||||
Since Cas.cade version 1.5 ,the default unit LENGTH is MILLIMETER.
|
||||
#define METER *1.
|
||||
#define CENTIMETER *0.01
|
||||
#define TOCENTIMETER(v) (v)*100.
|
||||
#define FROMCENTIMETER(v) (v)/100.
|
||||
#define MILLIMETER *0.001
|
||||
#define TOMILLIMETER(v) (v)*1000.
|
||||
#define FROMMILLIMETER(v) (v)/1000.
|
||||
*/
|
||||
|
||||
#define METER *1000.
|
||||
#define CENTIMETER *10.
|
||||
#define TOCENTIMETER(v) (v)/10.
|
||||
#define FROMCENTIMETER(v) (v)*10.
|
||||
#define MILLIMETER *1.
|
||||
#define TOMILLIMETER(v) v
|
||||
#define FROMMILLIMETER(v) v
|
||||
|
||||
#endif
|
6
src/Aspect/Aspect_WOKSteps.edl
Executable file
6
src/Aspect/Aspect_WOKSteps.edl
Executable file
@@ -0,0 +1,6 @@
|
||||
-- File: Aspect_WOKSteps.edl
|
||||
-- Author: bgn - Creation - 03-06-98
|
||||
-- History: Thu Feb 12 17:23:25 Romance Standard Time 1998
|
||||
|
||||
|
||||
@set %WOKSteps_UseSourceInclude = "";
|
80
src/Aspect/Aspect_WidthMap.cdl
Executable file
80
src/Aspect/Aspect_WidthMap.cdl
Executable file
@@ -0,0 +1,80 @@
|
||||
--
|
||||
-- File: Aspect_WidthMap.cdl
|
||||
-- Created: 23/03/93
|
||||
-- Author: GG
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
class WidthMap from Aspect inherits TShared from MMgt
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a WidthMap object.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
WidthOfLine from Aspect,
|
||||
WidthMapEntry from Aspect,
|
||||
SequenceOfWidthMapEntry from Aspect,
|
||||
Length from Quantity
|
||||
|
||||
raises
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
Create
|
||||
returns mutable WidthMap from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates a width map.
|
||||
|
||||
AddEntry (me : mutable; AnEntry : WidthMapEntry from Aspect)
|
||||
---Level: Public
|
||||
---Purpose: Adds an entry in the Width map <me>.
|
||||
-- Warning: Raises BadAccess if WidthMap size is exceeded.
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
AddEntry (me : mutable; aStyle : WidthOfLine from Aspect)
|
||||
returns Integer from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Search an identical line width entry in the width map <me>
|
||||
-- and returns the WidthMapEntry Index if exist.
|
||||
-- Or add a new entry and returns the computed WidthMapEntry index used.
|
||||
|
||||
AddEntry (me : mutable; aStyle : Length from Quantity)
|
||||
returns Integer from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Search an identical line width entry in the width map <me>
|
||||
-- and returns the WidthMapEntry Index if exist.
|
||||
-- Or add a new entry and returns the computed WidthMapEntry index used.
|
||||
|
||||
Size( me ) returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Allocated widthmap Size
|
||||
|
||||
Index( me ; aWidthmapIndex : Integer ) returns Integer from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the WidthMapEntry.Index of the WidthMap
|
||||
-- at rank <aWidthmapIndex> .
|
||||
raises BadAccess from Aspect is static;
|
||||
---Trigger: Raises BadAccess if the index less than 1 or
|
||||
-- greater than Size.
|
||||
|
||||
Entry ( me ;
|
||||
AnIndex : Integer from Standard )
|
||||
returns WidthMapEntry from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Returns the Width map entry with the index <AnIndex>.
|
||||
-- Warning: Raises BadAccess if the index less than 1 or
|
||||
-- greater than Size.
|
||||
raises BadAccess from Aspect is static;
|
||||
|
||||
Dump ( me ) ;
|
||||
---Level: Internal
|
||||
|
||||
fields
|
||||
mydata : SequenceOfWidthMapEntry from Aspect is protected;
|
||||
|
||||
end WidthMap ;
|
91
src/Aspect/Aspect_WidthMap.cxx
Executable file
91
src/Aspect/Aspect_WidthMap.cxx
Executable file
@@ -0,0 +1,91 @@
|
||||
|
||||
#include <Aspect_WidthMap.ixx>
|
||||
|
||||
Aspect_WidthMap::Aspect_WidthMap( ) {
|
||||
Aspect_WidthMapEntry theDefaultEntry;
|
||||
|
||||
AddEntry(theDefaultEntry);
|
||||
}
|
||||
|
||||
void Aspect_WidthMap::AddEntry (const Aspect_WidthMapEntry& AnEntry) {
|
||||
Standard_Integer i,index = AnEntry.Index();
|
||||
Aspect_WidthMapEntry theEntry;
|
||||
|
||||
for( i=1 ; i<=mydata.Length() ; i++ ) {
|
||||
theEntry = mydata.Value(i);
|
||||
if( index == theEntry.Index() ) break;
|
||||
}
|
||||
|
||||
if( i > mydata.Length() ) {
|
||||
mydata.Append( AnEntry );
|
||||
} else {
|
||||
mydata.SetValue(i,AnEntry);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_WidthMap::AddEntry (const Aspect_WidthOfLine aStyle) {
|
||||
Aspect_WidthMapEntry theEntry ;
|
||||
Standard_Integer i,maxindex = 0 ;
|
||||
|
||||
for( i=1 ; i<=mydata.Length() ; i++ ) {
|
||||
theEntry = mydata.Value(i) ;
|
||||
maxindex = Max(maxindex,theEntry.Index()) ;
|
||||
if( theEntry.Type() == aStyle ) return theEntry.Index() ;
|
||||
}
|
||||
|
||||
maxindex++ ;
|
||||
theEntry.SetValue(maxindex,aStyle) ;
|
||||
mydata.Append( theEntry ) ;
|
||||
return maxindex ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_WidthMap::AddEntry (const Quantity_Length aStyle) {
|
||||
Aspect_WidthMapEntry theEntry ;
|
||||
Standard_Integer i,maxindex = 0 ;
|
||||
|
||||
for( i=1 ; i<=mydata.Length() ; i++ ) {
|
||||
theEntry = mydata.Value(i) ;
|
||||
maxindex = Max(maxindex,theEntry.Index()) ;
|
||||
if( theEntry.Width() == aStyle ) return theEntry.Index() ;
|
||||
}
|
||||
|
||||
maxindex++ ;
|
||||
theEntry.SetValue(maxindex,aStyle) ;
|
||||
mydata.Append( theEntry ) ;
|
||||
return maxindex ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_WidthMap::Size() const {
|
||||
|
||||
return mydata.Length() ;
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_WidthMap::Index(const Standard_Integer anIndex) const {
|
||||
|
||||
if( anIndex < 1 || anIndex > Size() ) {
|
||||
Aspect_BadAccess::Raise ("Undefined widthmap Index");
|
||||
}
|
||||
|
||||
Aspect_WidthMapEntry theEntry = mydata.Value(anIndex) ;
|
||||
|
||||
return theEntry.Index() ;
|
||||
}
|
||||
|
||||
Aspect_WidthMapEntry Aspect_WidthMap::Entry (const Standard_Integer AnIndex) const {
|
||||
|
||||
if( AnIndex < 1 || AnIndex > mydata.Length() )
|
||||
Aspect_BadAccess::Raise ("Aspect_WidthMap::Entry Bad Index");
|
||||
|
||||
return mydata.Value(AnIndex);
|
||||
}
|
||||
|
||||
void Aspect_WidthMap::Dump () const {
|
||||
|
||||
Standard_Integer i ;
|
||||
|
||||
cout << "Widthmap Dump-->\n" ;
|
||||
|
||||
for ( i = 1 ; i <= Size() ; i++ ) (Entry(i)).Dump() ;
|
||||
|
||||
cout << "<--End Widthmap Dump\n" ;
|
||||
}
|
135
src/Aspect/Aspect_WidthMapEntry.cdl
Executable file
135
src/Aspect/Aspect_WidthMapEntry.cdl
Executable file
@@ -0,0 +1,135 @@
|
||||
|
||||
--
|
||||
-- File: Aspect_WidthMapEntry.cdl
|
||||
-- Created: 09/09/93
|
||||
-- Author: GG
|
||||
-- Updated by JLF (Reason : Width MUST be given in METER 2 Mars 94)
|
||||
--
|
||||
---Copyright: MatraDatavision 1993
|
||||
--
|
||||
|
||||
class WidthMapEntry from Aspect
|
||||
|
||||
---Version: 0.0
|
||||
|
||||
---Purpose: This class defines a widthmap entry.
|
||||
-- A widthmap entry is an association between
|
||||
-- a LineStyle object and an index in the widthmap.
|
||||
---Keywords:
|
||||
---Warning:
|
||||
---References:
|
||||
|
||||
uses
|
||||
WidthOfLine from Aspect,
|
||||
Length from Quantity
|
||||
|
||||
raises
|
||||
OutOfRange from Standard,
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
Create
|
||||
returns WidthMapEntry from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates an unallocated widthmap entry
|
||||
|
||||
Create ( index : Integer from Standard;
|
||||
style : WidthOfLine from Aspect)
|
||||
returns WidthMapEntry;
|
||||
---Level: Public
|
||||
---Purpose: Creates an allocated widthmap entry from width style
|
||||
|
||||
Create ( index : Integer from Standard;
|
||||
width : Length from Quantity)
|
||||
returns WidthMapEntry;
|
||||
---Level: Public
|
||||
---Purpose: Creates an allocated widthmap entry from width value
|
||||
|
||||
Create ( entry : WidthMapEntry from Aspect )
|
||||
returns WidthMapEntry
|
||||
---Level: Public
|
||||
---Purpose: Creates an allocated widthmap entry.
|
||||
---Warning: Raises error if the widthmap entry <entry>
|
||||
-- is unallocated.
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
SetValue ( me: in out; index : Integer from Standard;
|
||||
style : WidthOfLine from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Sets widthmap entry value from width style
|
||||
-- and allocates it.
|
||||
|
||||
SetValue ( me: in out; index : Integer from Standard;
|
||||
width : Length from Quantity);
|
||||
---Level: Public
|
||||
---Purpose: Sets widthmap entry value from width value
|
||||
-- and allocates it.
|
||||
|
||||
SetValue ( me: in out; entry : WidthMapEntry from Aspect);
|
||||
---Level: Public
|
||||
---Purpose: Sets widthmap entry value and allocates it.
|
||||
---C++: alias operator =
|
||||
|
||||
SetIndex ( me: in out; index : Integer from Standard);
|
||||
---Level: Public
|
||||
---Purpose: Sets index value of a widthmap entry.
|
||||
|
||||
SetType ( me: in out; Style : WidthOfLine from Aspect );
|
||||
---Level: Public
|
||||
---Purpose: Sets width style of widthmap entry.
|
||||
|
||||
SetWidth ( me: in out; Width : Length from Quantity);
|
||||
---Level: Public
|
||||
---Purpose: Sets width value of widthmap entry.
|
||||
|
||||
Type ( me ) returns WidthOfLine from Aspect
|
||||
---Level: Public
|
||||
---Warning: Raises error if the widthmap entry is unallocated .
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
Width ( me ) returns Length from Quantity
|
||||
---Level: Public
|
||||
---Purpose: Returns width value of widthmap entry.
|
||||
-- Warning: Raises error if the widthmap entry is unallocated .
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
Index ( me ) returns Integer from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns index value of a widthmap entry.
|
||||
-- Warning: Raises error if the widthmap entry is unallocated .
|
||||
raises BadAccess from Aspect;
|
||||
|
||||
Free ( me : in out );
|
||||
---Level: Public
|
||||
---Purpose: Unallocates the widthmap entry.
|
||||
|
||||
IsAllocated ( me ) returns Boolean from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns True if the widthmap entry is allocated.
|
||||
-- Warning: A widthmap entry is allocated when the width and
|
||||
-- the index is defined.
|
||||
|
||||
Dump( me );
|
||||
---Level: Internal
|
||||
|
||||
----------------------------
|
||||
-- Category: Private methods
|
||||
----------------------------
|
||||
|
||||
SetPredefinedStyle ( me : in out;
|
||||
Type : WidthOfLine from Aspect )
|
||||
---Level: Internal
|
||||
---Purpose: Set Line Width with the predefined style values
|
||||
-- according of type
|
||||
-- Warning: Raises error if the Width style is USER_DEFINED
|
||||
raises BadAccess from Aspect is private;
|
||||
---Category: Private methods
|
||||
|
||||
fields
|
||||
MyType : WidthOfLine from Aspect;
|
||||
MyWidth : Real from Standard;
|
||||
MyIndex : Integer from Standard;
|
||||
MyTypeIsDef : Boolean from Standard;
|
||||
MyIndexIsDef : Boolean from Standard;
|
||||
|
||||
end WidthMapEntry from Aspect;
|
177
src/Aspect/Aspect_WidthMapEntry.cxx
Executable file
177
src/Aspect/Aspect_WidthMapEntry.cxx
Executable file
@@ -0,0 +1,177 @@
|
||||
#include <Aspect_WidthMapEntry.ixx>
|
||||
#include <Aspect_Units.hxx>
|
||||
|
||||
Aspect_WidthMapEntry::Aspect_WidthMapEntry() {
|
||||
|
||||
SetPredefinedStyle(Aspect_WOL_THIN);
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = 0;
|
||||
|
||||
}
|
||||
|
||||
Aspect_WidthMapEntry::Aspect_WidthMapEntry (const Standard_Integer index, const Aspect_WidthOfLine style) {
|
||||
|
||||
SetPredefinedStyle(style);
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
|
||||
}
|
||||
|
||||
Aspect_WidthMapEntry::Aspect_WidthMapEntry (const Standard_Integer index, const Quantity_Length width) {
|
||||
|
||||
if( width < 0. )
|
||||
Aspect_BadAccess::Raise("Bad Line Width") ;
|
||||
|
||||
MyType = Aspect_WOL_USERDEFINED ;
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
MyWidth = width;
|
||||
|
||||
}
|
||||
|
||||
Aspect_WidthMapEntry::Aspect_WidthMapEntry (const Aspect_WidthMapEntry& entry) {
|
||||
|
||||
if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
|
||||
Aspect_BadAccess::Raise("Unallocated WidthMapEntry") ;
|
||||
}
|
||||
else {
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = entry.MyIndex;
|
||||
MyType = entry.MyType;
|
||||
MyWidth = entry.MyWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void Aspect_WidthMapEntry::SetValue (const Standard_Integer index, const Aspect_WidthOfLine style) {
|
||||
|
||||
SetPredefinedStyle(style);
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_WidthMapEntry::SetValue (const Standard_Integer index, const Quantity_Length width) {
|
||||
|
||||
if( width < 0. )
|
||||
Aspect_BadAccess::Raise("Bad Line Width") ;
|
||||
|
||||
MyType = Aspect_WOL_USERDEFINED ;
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyWidth = width ;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_WidthMapEntry::SetValue (const Aspect_WidthMapEntry& entry) {
|
||||
|
||||
if ( !entry.MyTypeIsDef || !entry.MyIndexIsDef ) {
|
||||
Aspect_BadAccess::Raise("Unallocated WidthMapEntry") ;
|
||||
}
|
||||
else {
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndexIsDef = Standard_True;
|
||||
MyIndex = entry.MyIndex;
|
||||
MyType = entry.MyType;
|
||||
MyWidth = entry.MyWidth;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Aspect_WidthMapEntry::SetType (const Aspect_WidthOfLine style) {
|
||||
|
||||
SetPredefinedStyle(style);
|
||||
|
||||
}
|
||||
|
||||
void Aspect_WidthMapEntry::SetWidth (const Quantity_Length width) {
|
||||
|
||||
if( width < 0. )
|
||||
Aspect_BadAccess::Raise("Bad Line Width") ;
|
||||
|
||||
MyType = Aspect_WOL_USERDEFINED ;
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyWidth = width ;
|
||||
|
||||
}
|
||||
|
||||
Aspect_WidthOfLine Aspect_WidthMapEntry::Type () const {
|
||||
|
||||
if ( !MyTypeIsDef || !MyIndexIsDef )
|
||||
Aspect_BadAccess::Raise("Unallocated WidthMapEntry") ;
|
||||
|
||||
return MyType;
|
||||
|
||||
}
|
||||
|
||||
Standard_Real Aspect_WidthMapEntry::Width () const {
|
||||
|
||||
if ( !MyTypeIsDef || !MyIndexIsDef )
|
||||
Aspect_BadAccess::Raise("Unallocated WidthMapEntry") ;
|
||||
|
||||
return MyWidth;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_WidthMapEntry::SetIndex (const Standard_Integer index) {
|
||||
|
||||
MyTypeIsDef = Standard_True;
|
||||
MyIndex = index;
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Aspect_WidthMapEntry::Index () const {
|
||||
|
||||
if ( !MyTypeIsDef || !MyIndexIsDef )
|
||||
Aspect_BadAccess::Raise("Unallocated WidthMapEntry");
|
||||
|
||||
return MyIndex;
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_WidthMapEntry::IsAllocated () const {
|
||||
|
||||
return ( MyTypeIsDef && MyIndexIsDef ) ;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_WidthMapEntry::Free () {
|
||||
|
||||
MyTypeIsDef = Standard_False;
|
||||
MyIndexIsDef = Standard_False;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_WidthMapEntry::Dump () const {
|
||||
|
||||
cout << " Aspect_WidthMapEntry::Dump ()\n";
|
||||
cout << " MyTypeIsDef : " << (MyTypeIsDef) ? "True\n" : "False\n";
|
||||
cout << " MyIndexIsDef : " << (MyIndexIsDef) ? "True\n" : "False\n";
|
||||
cout << " TypeOfWidth : " << (Standard_Integer) MyType << "\n";//WNT
|
||||
cout << " LineWidth : " << MyWidth << "\n";
|
||||
cout << flush;
|
||||
}
|
||||
|
||||
void Aspect_WidthMapEntry::SetPredefinedStyle(const Aspect_WidthOfLine Style) {
|
||||
|
||||
MyType = Style ;
|
||||
MyTypeIsDef = Standard_True;
|
||||
switch ( Style ) {
|
||||
case Aspect_WOL_USERDEFINED :
|
||||
Aspect_BadAccess::Raise("Bad Predefined Line Width Style") ;
|
||||
case Aspect_WOL_THIN:
|
||||
MyWidth = 0.25 MILLIMETER ;
|
||||
break ;
|
||||
case Aspect_WOL_MEDIUM :
|
||||
MyWidth = 0.5 MILLIMETER ;
|
||||
break ;
|
||||
case Aspect_WOL_THICK :
|
||||
MyWidth = 0.7 MILLIMETER ;
|
||||
break ;
|
||||
case Aspect_WOL_VERYTHICK :
|
||||
MyWidth = 1.5 MILLIMETER ;
|
||||
break ;
|
||||
}
|
||||
}
|
370
src/Aspect/Aspect_Window.cdl
Executable file
370
src/Aspect/Aspect_Window.cdl
Executable file
@@ -0,0 +1,370 @@
|
||||
--
|
||||
-- File: Aspect_Window.cdl
|
||||
-- Created: 23 fevrier 1993
|
||||
-- Author: NW,JPB,CAL
|
||||
-- Modified: GG 28/01/00 G004 Add gamma correction value in Dump methods.
|
||||
-- GG 07/03/00 G004 Add MMSize() method
|
||||
-- TCL 26/10/00 G002 SetBackground(aName: CString) method
|
||||
-- GG 28/11/00 G002 Add BackgroundImage(),
|
||||
-- BackgroundFillMethod(),
|
||||
-- HBackground() methods.
|
||||
-- SAV 24/11/01 SetBackground(Quantity_Color)
|
||||
--
|
||||
---Copyright: MatraDatavision 1991,1992,1993
|
||||
|
||||
deferred class Window from Aspect
|
||||
|
||||
inherits
|
||||
TShared from MMgt
|
||||
|
||||
---Purpose: This class allows the definition of a window
|
||||
-- Warning: The position and size for the creation of the window
|
||||
-- are defined in Device Screen Unit (DSU)
|
||||
-- floating [0,1] space.
|
||||
|
||||
uses
|
||||
Background from Aspect,
|
||||
GradientBackground from Aspect,
|
||||
GraphicDevice from Aspect,
|
||||
TypeOfResize from Aspect,
|
||||
FillMethod from Aspect,
|
||||
Handle from Aspect,
|
||||
PixMap from Aspect,
|
||||
Ratio from Quantity,
|
||||
Parameter from Quantity,
|
||||
NameOfColor from Quantity,
|
||||
Color from Quantity,
|
||||
AsciiString from TCollection
|
||||
|
||||
raises
|
||||
WindowDefinitionError from Aspect,
|
||||
WindowError from Aspect
|
||||
|
||||
is
|
||||
Initialize(aGraphicDevice: GraphicDevice from Aspect);
|
||||
---Level: Public
|
||||
---Purpose: Initializes the datas of a Window.
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
SetBackground ( me : mutable;
|
||||
ABack : Background from Aspect ) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground ( me : mutable ;
|
||||
BackColor : NameOfColor from Quantity ) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background from a Named Color.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground ( me : mutable; color : Color from Quantity ) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground( me: mutable;
|
||||
aName : CString from Standard;
|
||||
aMethod : FillMethod from Aspect = Aspect_FM_CENTERED)
|
||||
returns Boolean from Standard is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Loads the window background from an image file <aName>
|
||||
-- defined with a supported format XWD,GIF or BMP
|
||||
-- and returns TRUE if the operation is successfull.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground( me: mutable;
|
||||
aBitmap: Handle from Aspect) is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose: Loads the window background from a predefined bitmap.
|
||||
-- Warning: the bitmap and window must have the same depth.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground( me: mutable;
|
||||
ABackground: GradientBackground from Aspect) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window gradient background.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetDoubleBuffer ( me : mutable ;
|
||||
DBmode : Boolean from Standard )
|
||||
---Level: Advanced
|
||||
---Purpose: Activates/Deactivates the Double Buffering capability
|
||||
-- for this window.
|
||||
-- Warning: Double Buffering is always DISABLE by default
|
||||
-- If there is not enought ressources to activate the
|
||||
-- double-buffering the DB mode flag can be set to FALSE.
|
||||
---Category: Methods to modify the class definition
|
||||
is deferred;
|
||||
|
||||
Flush ( me )
|
||||
---Level: Advanced
|
||||
---Purpose: Flushs all graphics to the screen and Swap the Double
|
||||
-- buffer if Enable
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if Something is WRONG at Drawing Time.
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
Map ( me )
|
||||
raises WindowError from Aspect is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Opens the window <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
Unmap ( me )
|
||||
raises WindowError from Aspect is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Closes the window <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
DoResize ( me ) returns TypeOfResize from Aspect
|
||||
raises WindowError from Aspect is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose: Apply the resizing to the window <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
DoMapping ( me ) returns Boolean from Standard
|
||||
raises WindowError from Aspect is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose: Apply the mapping change to the window <me>.
|
||||
-- and returns TRUE if the window is mapped at screen.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
Destroy ( me : mutable )
|
||||
raises WindowError from Aspect is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose: Destroy the Window
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
Clear (me)
|
||||
raises WindowError from Aspect is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Clear The Window in the Background Color
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
ClearArea (me;
|
||||
XCenter, YCenter: Integer from Standard;
|
||||
Width , Height: Integer from Standard)
|
||||
raises WindowError from Aspect is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Clear The Window Area defined in PIXELS
|
||||
-- in the Background Color
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
Restore(me)
|
||||
---Level: Public
|
||||
---Purpose: Restore the BackingStored Window <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if BackingStore() is disable.
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
RestoreArea (me;
|
||||
XCenter, YCenter: Integer from Standard;
|
||||
Width , Height: Integer from Standard)
|
||||
---Level: Public
|
||||
---Purpose: Restore the BackingStored Window Area
|
||||
-- defined in PIXELS.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if BackingStore() is disable.
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
Dump ( me ; aFilename : CString from Standard;
|
||||
aGammaValue: Real from Standard = 1.0) returns Boolean
|
||||
---Level: Advanced
|
||||
---Purpose: Dumps the Window to an image file (PNG, BMP, JPEG, GIF) with
|
||||
--an optional gamma correction value according to the graphic system
|
||||
--and returns TRUE if the dump occurs normaly.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if Window is not defined properly
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
DumpArea ( me ; aFilename : CString from Standard ;
|
||||
Xc, Yc : Integer from Standard ;
|
||||
Width, Height : Integer from Standard;
|
||||
aGammaValue: Real from Standard = 1.0 ) returns Boolean
|
||||
---Level: Advanced
|
||||
---Purpose: Dumps the Window Area defined by his center and PIXEL size
|
||||
-- to an image file with
|
||||
-- an optional gamma correction value according to the graphic system
|
||||
--and returns TRUE if the dump occurs normaly.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if Window is not defined properly
|
||||
-- or the area is out of the Window.
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
ToPixMap ( me )
|
||||
returns PixMap from Aspect
|
||||
---Level : Public
|
||||
---Purpose : dump the full contents of the window to a pixmap.
|
||||
is deferred;
|
||||
|
||||
Load ( me ; aFilename : CString from Standard) returns Boolean
|
||||
---Level: Advanced
|
||||
---Purpose: Loads the XWD file to this Window.
|
||||
-- Returns TRUE if the loading occurs normaly.
|
||||
-- Warning: Note that the Window is enlarged automatically
|
||||
--when the image size is too large for this window.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if Window is not defined properly
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
LoadArea ( me ; aFilename : CString from Standard ;
|
||||
Xc, Yc : Integer from Standard ;
|
||||
Width, Height : Integer from Standard ) returns Boolean
|
||||
---Level: Advanced
|
||||
---Purpose: Loads the XWD file to Window Area defined by his center
|
||||
--and PIXEL size
|
||||
-- Returns TRUE if the loading occurs normaly.
|
||||
-- Warning: Note that the Image is zoomed automatically
|
||||
--when the image size is too large for this window area.
|
||||
---Category: Methods to modify the class definition
|
||||
---Trigger: Raises if Window is not defined properly
|
||||
-- or the area is out of the Window.
|
||||
raises WindowError from Aspect is deferred;
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
Background ( me ) returns Background from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns the window background.
|
||||
---Category: Inquire methods
|
||||
|
||||
BackgroundImage ( me ) returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns the current image background string
|
||||
-- or NULL if nothing is defined.
|
||||
|
||||
BackgroundFillMethod( me ) returns FillMethod from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns the current image background fill mode.
|
||||
|
||||
GradientBackground ( me ) returns GradientBackground from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns the window gradient background.
|
||||
|
||||
HBackground ( me )
|
||||
returns Handle from Aspect;
|
||||
---Level: Advanced
|
||||
---Purpose: Returns the background bitmap handle or
|
||||
-- 0 when nothing is defined
|
||||
---C++: inline
|
||||
|
||||
GraphicDevice ( me ) returns GraphicDevice from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Graphic Device associated to this Window.
|
||||
---Category: Inquire methods
|
||||
|
||||
IsMapped ( me ) returns Boolean from Standard is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns True if the window <me> is opened
|
||||
-- and False if the window is closed.
|
||||
---Category: Inquire methods
|
||||
|
||||
IsVirtual ( me ) returns Boolean from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns True if the window <me> is virtual
|
||||
---Category: Inquire methods
|
||||
|
||||
SetVirtual ( me : mutable;
|
||||
theVirtual : Boolean from Standard );
|
||||
---Level: Public
|
||||
---Purpose: Setup the virtual state
|
||||
---Category: Inquire methods
|
||||
|
||||
Ratio ( me ) returns Ratio from Quantity is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window RATIO equal to the physical
|
||||
-- WIDTH/HEIGHT dimensions
|
||||
---Category: Inquire methods
|
||||
|
||||
Position ( me ;
|
||||
X1, Y1 ,X2, Y2 : out Parameter from Quantity)
|
||||
is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window POSITION in DSU
|
||||
---Category: Inquire methods
|
||||
|
||||
Position ( me ;
|
||||
X1, Y1, X2, Y2 : out Integer from Standard )
|
||||
is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window POSITION in PIXEL
|
||||
---Category: Inquire methods
|
||||
|
||||
Size ( me ;
|
||||
Width, Height : out Parameter from Quantity )
|
||||
is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window SIZE in DSU
|
||||
---Category: Inquire methods
|
||||
|
||||
Size ( me ;
|
||||
Width, Height : out Integer from Standard )
|
||||
is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window SIZE in PIXEL
|
||||
---Category: Inquire methods
|
||||
|
||||
MMSize ( me ;
|
||||
Width, Height : out Real from Standard )
|
||||
is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window SIZE in MM
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ; PV : Integer from Standard )
|
||||
returns Parameter from Quantity is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DSU value depending of the PIXEL value.
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ; DV : Parameter from Quantity )
|
||||
returns Integer from Standard is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL value depending of the DSU value.
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ;
|
||||
PX, PY : Integer from Standard ;
|
||||
DX, DY : out Parameter from Quantity ) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DSU position depending of the PIXEL position.
|
||||
---Category: Inquire methods
|
||||
|
||||
Convert ( me ;
|
||||
DX, DY : Parameter from Quantity ;
|
||||
PX, PY : out Integer from Standard ) is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL position depending of the DSU position.
|
||||
---Category: Inquire methods
|
||||
|
||||
BackingStore(me) returns Boolean from Standard is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose: Returns the BackingStore capability for this Window .
|
||||
-- If Answer is True Exposure can be recovered by
|
||||
-- Restore RestoreArea methods .
|
||||
-- If Answer is False,Application must Redraw
|
||||
-- the exposed area.
|
||||
---Category: Inquire methods
|
||||
|
||||
DoubleBuffer ( me )
|
||||
returns Boolean from Standard is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose: Returns the DoubleBuffer state.
|
||||
---Category: Inquire methods
|
||||
|
||||
fields
|
||||
MyGraphicDevice : GraphicDevice from Aspect is protected;
|
||||
MyBackground : Background from Aspect is protected;
|
||||
MyBackgroundImage : AsciiString from TCollection is protected;
|
||||
MyBackgroundFillMethod : FillMethod from Aspect is protected;
|
||||
MyHBackground : Handle from Aspect is protected;
|
||||
MyGradientBackground : GradientBackground from Aspect is protected;
|
||||
MyIsVirtual : Boolean from Standard is protected;
|
||||
|
||||
end Window;
|
76
src/Aspect/Aspect_Window.cxx
Executable file
76
src/Aspect/Aspect_Window.cxx
Executable file
@@ -0,0 +1,76 @@
|
||||
|
||||
// File Aspect_Window.cxx
|
||||
// Created Fevrier 1993
|
||||
// Author NW,JPB,CAL,GG
|
||||
// Modified: GG 28/11/00 G002
|
||||
// Add BackgroundImage() and BackgroundFillMethod() methods
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992,1993
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Creation d'une fenetre
|
||||
|
||||
//-Warning
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Aspect_Window.ixx>
|
||||
|
||||
//-Aliases
|
||||
|
||||
//-Global data definitions
|
||||
|
||||
//-Destructors
|
||||
|
||||
//-Constructors
|
||||
|
||||
Aspect_Window::Aspect_Window (const Handle(Aspect_GraphicDevice)& aGraphicDevice)
|
||||
: MyGraphicDevice(aGraphicDevice),
|
||||
MyBackground(),
|
||||
MyBackgroundImage(),
|
||||
MyGradientBackground(),
|
||||
MyBackgroundFillMethod(Aspect_FM_NONE),
|
||||
MyHBackground(0)
|
||||
{
|
||||
}
|
||||
|
||||
Handle(Aspect_GraphicDevice) Aspect_Window::GraphicDevice() const
|
||||
{
|
||||
return MyGraphicDevice;
|
||||
}
|
||||
|
||||
Aspect_Background Aspect_Window::Background() const
|
||||
{
|
||||
return MyBackground;
|
||||
}
|
||||
|
||||
Standard_CString Aspect_Window::BackgroundImage() const
|
||||
{
|
||||
return MyBackgroundImage.ToCString();
|
||||
}
|
||||
|
||||
Aspect_FillMethod Aspect_Window::BackgroundFillMethod() const
|
||||
{
|
||||
return MyBackgroundFillMethod;
|
||||
}
|
||||
|
||||
Aspect_GradientBackground Aspect_Window::GradientBackground() const
|
||||
{
|
||||
return MyGradientBackground;
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_Window::IsVirtual() const
|
||||
{
|
||||
return MyIsVirtual;
|
||||
}
|
||||
|
||||
void Aspect_Window::SetVirtual (const Standard_Boolean theVirtual)
|
||||
{
|
||||
MyIsVirtual = theVirtual;
|
||||
}
|
5
src/Aspect/Aspect_Window.lxx
Executable file
5
src/Aspect/Aspect_Window.lxx
Executable file
@@ -0,0 +1,5 @@
|
||||
inline Aspect_Handle Aspect_Window :: HBackground () const {
|
||||
|
||||
return MyHBackground;
|
||||
|
||||
}
|
303
src/Aspect/Aspect_WindowDriver.cdl
Executable file
303
src/Aspect/Aspect_WindowDriver.cdl
Executable file
@@ -0,0 +1,303 @@
|
||||
|
||||
-- File: Aspect_WindowDriver.cdl
|
||||
-- Created: Wed Dec 8 09:18:54 1993
|
||||
-- Author: Jean Louis FRENKEL, Stephane CALLEGARI
|
||||
-- <jlf@stylox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
deferred class WindowDriver from Aspect inherits Driver from Aspect
|
||||
|
||||
---Purpose: defines the WINDOW oriented output driver.
|
||||
-- Warning: A limited number of mono attribute and translatable BUFFERS can be defined
|
||||
-- for retaining a lot of primitives for DRAGGING .
|
||||
--
|
||||
|
||||
uses
|
||||
TypeOfResize from Aspect,
|
||||
Window from Aspect,
|
||||
TypeOfDrawMode from Aspect,
|
||||
Factor from Quantity,
|
||||
PlaneAngle from Quantity,
|
||||
ExtendedString from TCollection
|
||||
|
||||
raises
|
||||
DriverError from Aspect
|
||||
|
||||
is
|
||||
Initialize(aWindow: Window from Aspect);
|
||||
|
||||
BeginDraw (me: mutable;
|
||||
DoubleBuffer: Boolean = Standard_True;
|
||||
aRetainBuffer: Integer = 0)
|
||||
---Purpose: Begin graphics and drawn directly to the Window or Pixmap if
|
||||
--<aRetainBuffer> is 0 or in the retain buffer if > 0.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if the retain buffer is not open.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
ResizeSpace(me : mutable)
|
||||
returns TypeOfResize from Aspect
|
||||
raises DriverError from Aspect
|
||||
is deferred;
|
||||
|
||||
Window(me) returns Window from Aspect;
|
||||
|
||||
SetDrawMode (me: mutable;
|
||||
aMode: TypeOfDrawMode from Aspect)
|
||||
is deferred;
|
||||
---Level: Public
|
||||
---Purpose: Change the current drawing mode of the Driver
|
||||
-- XW_REPLACE : the primitive is drawn with his defined color.
|
||||
-- XW_ERASE : the primitive is erased from the window.
|
||||
-- XW_XOR : the primitive is xored to the window.
|
||||
-- XW_XORLIGHT: the primitive is xored depending of the current
|
||||
-- highlight and background colors.
|
||||
|
||||
-------------------------------------------------------------
|
||||
-- Category: Methods to define or edit a buffer of primitives
|
||||
-------------------------------------------------------------
|
||||
|
||||
OpenBuffer (me: mutable; aRetainBuffer: Integer;
|
||||
aPivotX: ShortReal = 0.0;
|
||||
aPivotY: ShortReal = 0.0;
|
||||
aWidthIndex: Integer = 0;
|
||||
aColorIndex: Integer = 0;
|
||||
aFontIndex: Integer = 0;
|
||||
aDrawMode: TypeOfDrawMode = Aspect_TODM_REPLACE)
|
||||
returns Boolean is deferred;
|
||||
---Purpose: Allocate the retain buffer <aRetainBuffer> ,
|
||||
-- Defines the DWU coordinates of the pivot point for all primitives
|
||||
--contains inside.
|
||||
-- Defines the buffer color and font index :
|
||||
-- the default color is the highlight color of the colormap.
|
||||
-- the default font is the default system font of the fontmap.
|
||||
-- The other attributes are fixed :
|
||||
-- line type is Solid,
|
||||
-- line width is 1 Pixel,
|
||||
-- polygon fill mode is Solid,
|
||||
-- Warning: The number of allocated buffers is limited,it's
|
||||
--recommended to close unused buffers some time!
|
||||
-- The TypeOfDrawMode REPLACE is enabled only if the
|
||||
-- background drawing has been drawn with the DoubleBuffer
|
||||
-- flag set to ENABLE at the last BeginDraw time.
|
||||
-- The TypeOfDrawMode XOR is enabled in any case.
|
||||
-- The other TypeOfDrawMode are not authorized.
|
||||
-- Returns TRUE if the buffer is allocated and enabled for drawing.
|
||||
|
||||
CloseBuffer (me; aRetainBuffer: Integer)
|
||||
---Purpose: Clear & Deallocate the retain buffer <aRetainBuffer>.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
ClearBuffer (me; aRetainBuffer: Integer)
|
||||
---Purpose: Erase & Clear ALL primitives retains in the buffer <aRetainBuffer>.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
DrawBuffer (me; aRetainBuffer: Integer)
|
||||
---Purpose: Draw ALL primitives retains in the buffer <aRetainBuffer>.
|
||||
-- Warning: Note that the aspect of a retain buffer drawing is
|
||||
-- mono-colored with the current buffer Attributes and
|
||||
-- Depending of the DoubleBuffer state flag at the BeginDraw() buffer time,
|
||||
-- when DB is TRUE,an XOR method is use for drawing and erasing buffers in the
|
||||
-- same way.In this case,some color side effect can occurs depending of the
|
||||
-- traversal primitive colors and the supported hardware.
|
||||
-- when DB is FALSE and the background drawing has been generated with
|
||||
-- DB at TRUE,no color side effect occurs because the DB is used for restoring
|
||||
-- the drawing context at EraseBuffer() time,this is more powerfull for the
|
||||
-- drawing quality excepted for large buffers (flicking) .
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
EraseBuffer (me; aRetainBuffer: Integer)
|
||||
---Purpose: Erase ALL primitives retains in the buffer <aRetainBuffer>.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
MoveBuffer (me; aRetainBuffer: Integer;
|
||||
aPivotX: ShortReal = 0.0;
|
||||
aPivotY: ShortReal = 0.0)
|
||||
---Purpose: Erase , Translate and reDraw ALL primitives retains in the buffer
|
||||
--<aRetainBuffer>.
|
||||
--<aPivotX,aPivotY> are the new DWU attached point absolute coordinates
|
||||
--of the buffer pivot point.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if the retain buffer is not opened
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
ScaleBuffer (me; aRetainBuffer: Integer; aScaleX: Factor = 1.0;
|
||||
aScaleY: Factor = 1.0)
|
||||
---Purpose: Erase , Scale the buffer from the Pivot point and reDraw ALL primitives
|
||||
--retains in the buffer <aRetainBuffer>.
|
||||
--<aScaleX,aScaleY> are the absolute scale factors apply on the two axis.
|
||||
-- Warning: Note that the scalling of some primitives can provided some bad
|
||||
--smoothing side effect (i.e: Circles,...)
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if the retain buffer is not opened or
|
||||
--one of <aScale> factor is <= 0.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
RotateBuffer (me; aRetainBuffer: Integer; anAngle: PlaneAngle = 0.0)
|
||||
---Purpose: Erase , Rotate the buffer from the Pivot point and reDraw ALL primitives
|
||||
--retains in the buffer <aRetainBuffer>.
|
||||
--<anAngle> is the absolute counter-clockwise rotation angle from the
|
||||
--Horizontal axis.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
BufferIsOpen(me; aRetainBuffer : Integer) returns Boolean is deferred;
|
||||
---Purpose: Returns TRUE if the retain buffer <aRetainBuffer> is enabled
|
||||
--for drawing.
|
||||
|
||||
BufferIsEmpty(me; aRetainBuffer : Integer) returns Boolean is deferred;
|
||||
---Purpose: Returns TRUE if the retain buffer has not been opened or empty.
|
||||
--- Returns FALSE if a lot of primitives have been stored inside
|
||||
-- because a BeginDraw(..,<aRetainBuffer>) has been done previously.
|
||||
|
||||
BufferIsDrawn(me; aRetainBuffer : Integer) returns Boolean is deferred;
|
||||
---Purpose: Returns TRUE if the retain buffer s actually displayed at screen.
|
||||
|
||||
AngleOfBuffer(me; aRetainBuffer : Integer; anAngle: out PlaneAngle)
|
||||
---Purpose: Returns the current buffer rotate angle from the X axis.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
ScaleOfBuffer(me; aRetainBuffer : Integer; aScaleX,aScaleY: out Factor)
|
||||
---Purpose: Returns the current buffer scale factors.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
PositionOfBuffer(me; aRetainBuffer : Integer; aPivotX,aPivotY: out ShortReal )
|
||||
---Purpose: Returns the current buffer position.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
TextSize (me; aText: ExtendedString from TCollection;
|
||||
aWidth, aHeight: out ShortReal from Standard;
|
||||
aFontIndex: Integer from Standard = -1)
|
||||
---Level: Public
|
||||
---Purpose: Returns the TEXT size in DWU space depending
|
||||
-- of the required FontIndex if aFontIndex is >= 0
|
||||
-- or the current FontIndex if < 0 (default).
|
||||
---Trigger: Raises if font is not defined.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Inquire methods
|
||||
|
||||
TextSize (me; aText: ExtendedString from TCollection;
|
||||
aWidth, aHeight, anXoffset, anYoffset: out ShortReal from Standard;
|
||||
aFontIndex: Integer from Standard = -1)
|
||||
---Level: Public
|
||||
---Purpose: Returns the TEXT size and offsets
|
||||
-- in DWU space depending
|
||||
-- of the required FontIndex if aFontIndex is >= 0
|
||||
-- or the current FontIndex if < 0 (default).
|
||||
---Trigger: Raises if font is not defined.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Inquire methods
|
||||
|
||||
FontSize (me; aSlant: out PlaneAngle from Quantity;
|
||||
aSize,aBheight: out ShortReal from Standard;
|
||||
aFontIndex: Integer from Standard = -1)
|
||||
returns CString from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the font string,slant,size and
|
||||
--baseline height in DWU space depending
|
||||
-- of the required FontIndex if aFontIndex is >= 0
|
||||
-- or the current FontIndex if < 0 (default).
|
||||
---Trigger: Raises if font is not defined.
|
||||
raises DriverError from Aspect is deferred;
|
||||
---Category: Inquire methods
|
||||
|
||||
ColorBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard)
|
||||
is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the min and max driver virtual color indexs.
|
||||
---Category: Inquire methods
|
||||
|
||||
LocalColorIndex(me; anIndex : Integer from Standard)
|
||||
returns Integer from Standard is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the local colormap hardware index from a virtual driver color
|
||||
-- index or returns -1 if the index is not defined.
|
||||
---Category: Inquire methods
|
||||
|
||||
FontBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard)
|
||||
is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the min and max driver virtual font indexs.
|
||||
---Category: Inquire methods
|
||||
|
||||
LocalFontIndex(me; anIndex : Integer from Standard)
|
||||
returns Integer from Standard is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the associated fontmap hardware index from a virtual driver font
|
||||
-- index or returns -1 if the index is not defined.
|
||||
---Category: Inquire methods
|
||||
|
||||
TypeBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard)
|
||||
is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the min and max driver virtual type indexs.
|
||||
---Category: Inquire methods
|
||||
|
||||
LocalTypeIndex(me; anIndex : Integer from Standard)
|
||||
returns Integer from Standard is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the associated typemap hardware index from a virtual driver type
|
||||
-- index or returns -1 if the index is not defined.
|
||||
---Category: Inquire methods
|
||||
|
||||
WidthBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard)
|
||||
is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the min and max driver virtual width indexs.
|
||||
---Category: Inquire methods
|
||||
|
||||
LocalWidthIndex(me; anIndex : Integer from Standard)
|
||||
returns Integer from Standard is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the associated widthmap hardware index from a virtual driver width
|
||||
-- index or returns -1 if the index is not defined.
|
||||
---Category: Inquire methods
|
||||
|
||||
MarkBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard)
|
||||
is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the min and max driver virtual marker indexs.
|
||||
---Category: Inquire methods
|
||||
|
||||
LocalMarkIndex(me; anIndex : Integer from Standard)
|
||||
returns Integer from Standard is deferred;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the local markmap hardware index from a virtual driver marker
|
||||
-- index or returns -1 if the index is not defined.
|
||||
---Category: Inquire methods
|
||||
|
||||
fields
|
||||
MyWindow : Window from Aspect is protected;
|
||||
MyDrawMode : TypeOfDrawMode from Aspect is protected;
|
||||
MyRetainBuffer : Integer from Standard is protected;
|
||||
|
||||
end WindowDriver from Aspect;
|
9
src/Aspect/Aspect_WindowDriver.cxx
Executable file
9
src/Aspect/Aspect_WindowDriver.cxx
Executable file
@@ -0,0 +1,9 @@
|
||||
#include <Aspect_WindowDriver.ixx>
|
||||
|
||||
Aspect_WindowDriver::Aspect_WindowDriver(const Handle(Aspect_Window)& aWindow) : MyWindow(aWindow) {}
|
||||
|
||||
Handle(Aspect_Window) Aspect_WindowDriver::Window() const {
|
||||
|
||||
return MyWindow;
|
||||
|
||||
}
|
80
src/Aspect/Aspect_XWD.hxx
Executable file
80
src/Aspect/Aspect_XWD.hxx
Executable file
@@ -0,0 +1,80 @@
|
||||
#ifndef __Aspect_WNTXWD_HXX
|
||||
# define __Aspect_WNTXWD_HXX
|
||||
|
||||
# ifndef WNT
|
||||
# include <X11/XWDFile.h>
|
||||
# else
|
||||
|
||||
# ifdef WORD64
|
||||
# define B32 :32
|
||||
# else
|
||||
# define B32
|
||||
# endif /* WORD64 */
|
||||
|
||||
# define XWD_FILE_VERSION 7
|
||||
|
||||
# define XYBitmap 0
|
||||
# define XYPixmap 1
|
||||
# define ZPixmap 2
|
||||
|
||||
# define LSBFirst 0
|
||||
# define MSBFirst 1
|
||||
|
||||
# define DoRed ( 1 << 0 )
|
||||
# define DoGreen ( 1 << 1 )
|
||||
# define DoBlue ( 1 << 2 )
|
||||
|
||||
# define StaticGray 0
|
||||
# define GrayScale 1
|
||||
# define StaticColor 2
|
||||
# define PseudoColor 3
|
||||
# define TrueColor 4
|
||||
# define DirectColor 5
|
||||
|
||||
typedef unsigned int CARD32;
|
||||
|
||||
typedef struct _xwd_file_header {
|
||||
|
||||
CARD32 header_size B32;
|
||||
CARD32 file_version B32;
|
||||
CARD32 pixmap_format B32;
|
||||
CARD32 pixmap_depth B32;
|
||||
CARD32 pixmap_width B32;
|
||||
CARD32 pixmap_height B32;
|
||||
CARD32 xoffset B32;
|
||||
CARD32 byte_order B32;
|
||||
CARD32 bitmap_unit B32;
|
||||
CARD32 bitmap_bit_order B32;
|
||||
CARD32 bitmap_pad B32;
|
||||
CARD32 bits_per_pixel B32;
|
||||
CARD32 bytes_per_line B32;
|
||||
CARD32 visual_class B32;
|
||||
CARD32 red_mask B32;
|
||||
CARD32 green_mask B32;
|
||||
CARD32 blue_mask B32;
|
||||
CARD32 bits_per_rgb B32;
|
||||
CARD32 colormap_entries B32;
|
||||
CARD32 ncolors B32;
|
||||
CARD32 window_width B32;
|
||||
CARD32 window_height B32;
|
||||
CARD32 window_x B32;
|
||||
CARD32 window_y B32;
|
||||
CARD32 window_bdrwidth B32;
|
||||
# ifdef WORD64
|
||||
CARD32 header_end B32;
|
||||
# endif /* WORD64 */
|
||||
} XWDFileHeader;
|
||||
|
||||
typedef struct _xcolor {
|
||||
|
||||
unsigned long pixel;
|
||||
unsigned short red;
|
||||
unsigned short green;
|
||||
unsigned short blue;
|
||||
char flags;
|
||||
char pad;
|
||||
|
||||
} XColor;
|
||||
|
||||
# endif /* WNT */
|
||||
#endif /* __Aspect_WNTXWD_HXX */
|
21
src/Aspect/FILES
Executable file
21
src/Aspect/FILES
Executable file
@@ -0,0 +1,21 @@
|
||||
Aspect_WOKSteps.edl
|
||||
Aspect_CMPLRS.edl
|
||||
Aspect_FStream.hxx
|
||||
Aspect_FStream.cxx
|
||||
Aspect_IFStream.hxx
|
||||
Aspect_IFStream.cxx
|
||||
Aspect_CLayer2d.hxx
|
||||
Aspect_CLayer2d.cxx
|
||||
Aspect_RGBPixel.hxx
|
||||
Aspect_RGBPixel.cxx
|
||||
Aspect_Handle.cxx
|
||||
Aspect_Handle.hxx
|
||||
Aspect_XWD.hxx
|
||||
Aspect_Units.hxx
|
||||
Aspect_RenderingContext.hxx
|
||||
Aspect_GraphicCallbackProc.hxx
|
||||
Aspect_Display.hxx
|
||||
Aspect_Drawable.hxx
|
||||
Aspect_PolygonOffsetMode.hxx
|
||||
Aspect_GradientBackground.cxx
|
||||
Aspect_Convert.hxx
|
Reference in New Issue
Block a user