Logo Search packages:      
Sourcecode: qcad version File versions  Download package

rs.h

/****************************************************************************
** $Id: rs.h,v 1.64 2004/09/11 20:05:47 andrew Exp $
**
** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
**
** This file is part of the qcadlib Library project.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid qcadlib Professional Edition licenses may use 
** this file in accordance with the qcadlib Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.ribbonsoft.com for further details.
**
** Contact info@ribbonsoft.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/

#ifndef RS_H
#define RS_H

#include <qnamespace.h>
#include <qprinter.h>

#define RS_TEST

#ifdef RS_TEST
#include <assert.h>
#endif

// Windoze XP can't handle the original MAX/MINDOUBLE's
#define RS_MAXDOUBLE 1.0E+10
#define RS_MINDOUBLE -1.0E+10


/**
 * Class namespace for various enums along with some simple
 * wrapper methods for converting the enums to the Qt
 * counterparts.
 *
 * @author Andrew Mustun
 */
00051 class RS2 {
public:

    /**
     * Flags.
     */
00057     enum Flags {
        /** Flag for Undoables. */
00059         FlagUndone      = 1<<0,
        /** Entity Visibility. */
00061         FlagVisible     = 1<<1,
        /** Entity attribute (e.g. color) is defined by layer. */
00063         FlagByLayer     = 1<<2,
        /** Entity attribute (e.g. color) defined by block. */
00065         FlagByBlock     = 1<<3,
        /** Layer frozen. */
00067         FlagFrozen      = 1<<4,
        /** Layer frozen by default. */
00069         FlagDefFrozen   = 1<<5,
        /** Layer locked. */
00071         FlagLocked      = 1<<6,
        /** Used for invalid pens. */
00073         FlagInvalid     = 1<<7,
        /** Entity in current selection. */
00075         FlagSelected    = 1<<8,
        /** Polyline closed? */
00077         FlagClosed      = 1<<9,
        /** Flag for temporary entities (e.g. hatch) */
00079         FlagTemp        = 1<<10,
        /** Flag for processed entities (optcontour) */
00081         FlagProcessed   = 1<<11,
        /** Startpoint selected */
00083         FlagSelected1   = 1<<12,
        /** Endpoint selected */
00085         FlagSelected2   = 1<<13,
            /** Entity is highlighted temporarily (as a user action feedback) */
00087             FlagHighlighted = 1<<14
    };

    /**
     * Variable types used by RS_VariableDict and RS_Variable.
     */
00093     enum VariableType {
        VariableString,
        VariableInt,
        VariableDouble,
        VariableVector,
        VariableVoid
    };

    /**
     * File types. Used by file dialogs. Note: the extension might not
     * be enough to distinguish file types.
     */
00105     enum FormatType {
00106         FormatUnknown,       /**< Unknown / unsupported format. */
00107         FormatDXF1,          /**< QCad 1 compatibility DXF format. */
00108         FormatDXF,           /**< DXF format. 2000. */
00109         FormatDXF12,         /**< DXF format. R12. */
00110         FormatCXF,           /**< CAM Expert Font format. */
00111             FormatCAM            /**< CAM Expert CAM format (NC, CNC, D, ..) */
    };

    /**
     * Entity types returned by the rtti() method
     */
00117     enum EntityType {
00118         EntityUnknown,      /**< Unknown */
00119         EntityContainer,    /**< Container */
00120         EntityBlock,        /**< Block (Group definition) */
00121         EntityFontChar,     /**< Font character */
00122         EntityInsert,       /**< Insert (Group instance) */
00123         EntityGraphic,      /**< Graphic with layers */
00124         EntityPoint,        /**< Point */
00125         EntityLine,         /**< Line */
00126         EntityPolyline,     /**< Polyline */
00127         EntityVertex,       /**< Vertex (part of a polyline) */
00128         EntityArc,          /**< Arc */
00129         EntityCircle,       /**< Circle */
00130         EntityEllipse,      /**< Ellipse */
00131         EntitySolid,        /**< Ellipse */
00132         EntityConstructionLine, /**< Construction line */
00133         EntityText,         /**< Text */
00134         EntityDimAligned,   /**< Aligned Dimension */
00135         EntityDimLinear,    /**< Linear Dimension */
00136         EntityDimRadial,    /**< Radial Dimension */
00137         EntityDimDiametric, /**< Diametric Dimension */
00138         EntityDimAngular,   /**< Angular Dimension */
00139         EntityDimLeader,    /**< Leader Dimension */
00140         EntityHatch,        /**< Hatch */
00141         EntityImage,        /**< Image */
00142         EntitySpline        /**< Spline */
    };

    /**
     * Action types used by action factories.
     */
00148     enum ActionType {
00149         ActionNone,        /**< Invalid action id. */
            
        ActionDefault,

        ActionFileNew,
        ActionFileOpen,
        ActionFileSave,
        ActionFileSaveAs,
        ActionFileExport,
        ActionFileClose,
        ActionFilePrint,
        ActionFilePrintPreview,
        ActionFileQuit,
            
        ActionPrintPreview,

        ActionEditUndo,
        ActionEditRedo,
        ActionEditCut,
        ActionEditCutNoSelect,
        ActionEditCopy,
        ActionEditCopyNoSelect,
        ActionEditPaste,

        ActionViewStatusBar,
        ActionViewLayerList,
        ActionViewBlockList,
        ActionViewCommandLine,
        ActionViewOptionToolbar,
        ActionViewGrid,
        ActionViewDraft,

        ActionZoomIn,
        ActionZoomOut,
        ActionZoomAuto,
        ActionZoomWindow,
        ActionZoomPan,
        ActionZoomRedraw,
        ActionZoomPrevious,

        ActionSelectSingle,
        ActionSelectContour,
        ActionSelectWindow,
        ActionDeselectWindow,
        ActionSelectAll,
        ActionDeselectAll,
        ActionSelectIntersected,
        ActionDeselectIntersected,
        ActionSelectInvert,
        ActionSelectLayer,
        ActionSelectDouble,

        ActionDrawArc,
        ActionDrawArc3P,
        ActionDrawArcParallel,
        ActionDrawCircle,
        ActionDrawCircle2P,
        ActionDrawCircle3P,
        ActionDrawCircleCR,
        ActionDrawCircleParallel,
        ActionDrawEllipseArcAxis,
        ActionDrawEllipseAxis,
        ActionDrawHatch,
        ActionDrawHatchNoSelect,
        ActionDrawImage,
        ActionDrawLine,
        ActionDrawLineAngle,
        ActionDrawLineBisector,
        ActionDrawLineFree,
        ActionDrawLineHorVert,
        ActionDrawLineHorizontal,
        ActionDrawLineOrthogonal,
        ActionDrawLineParallel,
        ActionDrawLineParallelThrough,
        ActionDrawLinePolygon,
        ActionDrawLinePolygon2,
        ActionDrawLinePolyline,
        ActionDrawLineRectangle,
        ActionDrawLineRelAngle,
        ActionDrawLineTangent1,
        ActionDrawLineTangent2,
        ActionDrawLineVertical,
        ActionDrawPoint,
        ActionDrawSpline,
        ActionDrawText,

        ActionDimAligned,
        ActionDimLinear,
        ActionDimLinearVer,
        ActionDimLinearHor,
        ActionDimRadial,
        ActionDimDiametric,
        ActionDimAngular,
        ActionDimLeader,

        ActionModifyAttributes,
        ActionModifyAttributesNoSelect,
        ActionModifyDelete,
        ActionModifyDeleteNoSelect,
        ActionModifyDeleteQuick,
        ActionModifyDeleteFree,
        ActionModifyMove,
        ActionModifyMoveNoSelect,
        ActionModifyRotate,
        ActionModifyRotateNoSelect,
        ActionModifyScale,
        ActionModifyScaleNoSelect,
        ActionModifyMirror,
        ActionModifyMirrorNoSelect,
        ActionModifyMoveRotate,
        ActionModifyMoveRotateNoSelect,
        ActionModifyRotate2,
        ActionModifyRotate2NoSelect,
        ActionModifyEntity,
        ActionModifyTrim,
        ActionModifyTrim2,
        ActionModifyTrimAmount,
        ActionModifyCut,
        ActionModifyStretch,
        ActionModifyBevel,
        ActionModifyRound,

        ActionSnapFree,
        ActionSnapGrid,
        ActionSnapEndpoint,
        ActionSnapOnEntity,
        ActionSnapCenter,
        ActionSnapMiddle,
        ActionSnapDist,
        ActionSnapIntersection,
        ActionSnapIntersectionManual,

        ActionRestrictNothing,
        ActionRestrictOrthogonal,
        ActionRestrictHorizontal,
        ActionRestrictVertical,

        ActionSetRelativeZero,
        ActionLockRelativeZero,
        ActionUnlockRelativeZero,

        ActionInfoInside,
        ActionInfoDist,
        ActionInfoDist2,
        ActionInfoAngle,
        ActionInfoTotalLength,
        ActionInfoTotalLengthNoSelect,
        ActionInfoArea,

        ActionLayersDefreezeAll,
        ActionLayersFreezeAll,
        ActionLayersAdd,
        ActionLayersRemove,
        ActionLayersEdit,
        ActionLayersToggleView,
        ActionLayersToggleLock,

        ActionBlocksDefreezeAll,
        ActionBlocksFreezeAll,
        ActionBlocksAdd,
        ActionBlocksRemove,
        ActionBlocksAttributes,
        ActionBlocksEdit,
        ActionBlocksInsert,
        ActionBlocksToggleView,
        ActionBlocksCreate,
        ActionBlocksCreateNoSelect,
        ActionBlocksExplode,
        ActionBlocksExplodeNoSelect,
            
        ActionModifyExplodeText,
        ActionModifyExplodeTextNoSelect,
            
        ActionLibraryInsert,

        ActionOptionsGeneral,
        ActionOptionsDrawing,

            ActionToolRegenerateDimensions,

            ActionScriptOpenIDE,
            ActionScriptRun,

#ifndef RS_NO_COMPLEX_ENTITIES
            ActionPARISDebugCreateContainer,
#endif

#ifdef RS_CAM
            ActionCamExportAuto,
            ActionCamReorder,
#endif

        /** Needed to loop through all actions */
00342         ActionLast
    };

    /**
    * Entity ending. Used for returning which end of an entity is ment.
     */
00348     enum Ending {
00349         EndingStart,    /**< Start point. */
00350         EndingEnd,      /**< End point. */
00351         EndingNone      /**< Neither. */
    };

    /**
     * Update mode for non-atomic entities that need to be updated when 
     * they change. e.g. texts, inserts, ...
     */
00358     enum UpdateMode {
00359         NoUpdate,       /**< No automatic updates. */
00360         Update,         /**< Always update automatically when modified. */
00361             PreviewUpdate   /**< Update automatically but only for previews (quick update) */
    };

    /**
     * Drawing mode.
     */
00367     enum DrawingMode {
00368         ModeFull,       /**< Draw everything always detailed (default) */
00369         ModeAuto,       /**< Draw details when reasonable */
00370         ModePreview,    /**< Draw only in black/white without styles */
00371         ModeXOR,        /**< XOR mode for moving previews */
00372             ModeBW          /**< Black/white. Can be used for printing. */
    };

    /**
     * Undoable rtti.
     */
00378     enum UndoableType {
00379         UndoableUnknown,    /**< Unknown undoable */
00380         UndoableEntity,     /**< Entity */
00381         UndoableLayer       /**< Layer */
    };

    /**
     * Toolbar ID's.
     */
00387     enum ToolBarId {
00388         ToolBarMain,        /**< Main (menu). */
00389         ToolBarPoints,      /**< Points. */
00390         ToolBarLines,       /**< Lines. */
00391         ToolBarArcs,        /**< Arcs. */
00392         ToolBarCircles,     /**< Circles. */
00393         ToolBarEllipses,    /**< Ellipses. */
00394         ToolBarSplines,     /**< Splines. */
00395         ToolBarText,        /**< Text. */
00396         ToolBarDim,         /**< Dimensions. */
00397         ToolBarSnap,        /**< Snap. */
00398         ToolBarModify,      /**< Modify. */
00399         ToolBarSelect,      /**< Select. */
00400         ToolBarInfo         /**< Information */
    };

    /**
     * Units.
     */
00406     enum Unit {
00407         None = 0,               /**< No unit (unit from parent) */
00408         Inch = 1,               /**< Inch */
00409         Foot = 2,               /**< Foot: 12 Inches */
00410         Mile = 3,               /**< Mile: 1760 Yards = 1609 m */
00411         Millimeter = 4,         /**< Millimeter: 0.001m */
00412         Centimeter = 5,         /**< Centimeter: 0.01m */
00413         Meter = 6,              /**< Meter */
00414         Kilometer = 7,          /**< Kilometer: 1000m */
00415         Microinch = 8,          /**< Microinch: 0.000001 */
00416         Mil = 9,                /**< Mil = 0.001 Inch*/
00417         Yard = 10,              /**< Yard: 3 Feet */
00418         Angstrom = 11,          /**< Angstrom: 10^-10m  */
00419         Nanometer = 12,         /**< Nanometer: 10^-9m  */
00420         Micron = 13,            /**< Micron: 10^-6m  */
00421         Decimeter = 14,         /**< Decimeter: 0.1m */
00422         Decameter = 15,         /**< Decameter: 10m */
00423         Hectometer = 16,        /**< Hectometer: 100m */
00424         Gigameter = 17,         /**< Gigameter: 1000000m */
00425         Astro = 18,             /**< Astro: 149.6 x 10^9m */
00426         Lightyear = 19,         /**< Lightyear: 9460731798 x 10^6m */
00427         Parsec = 20,            /**< Parsec: 30857 x 10^12 */
            
00429         LastUnit = 21           /**< Used to iterate through units */
    };


    /**
     * Format for length values.
     */
00436     enum LinearFormat {
        /** Scientific (e.g. 2.5E+05) */
00438         Scientific,
        /** Decimal (e.g. 9.5)*/
00440         Decimal,
        /** Engineering (e.g. 7' 11.5")*/
00442         Engineering,
        /** Architectural (e.g. 7'-9 1/8")*/
00444         Architectural,
        /** Fractional (e.g. 7 9 1/8) */
00446         Fractional
    };

    /**
     * Angle Units.
     */
00452     enum AngleUnit {
00453         Deg,               /**< Degrees */
00454         Rad,               /**< Radians */
00455         Gra                /**< Gradians */
    };

    /**
     * Display formats for angles.
     */
00461     enum AngleFormat {
        /** Degrees with decimal point (e.g. 24.5) */
00463         DegreesDecimal,
        /** Degrees, Minutes and Seconds (e.g. 2430'5'') */
00465         DegreesMinutesSeconds,
        /** Gradians with decimal point (e.g. 390.5)*/
00467         Gradians,
        /** Radians with decimal point (e.g. 1.57)*/
00469         Radians,
        /** Surveyor's units */
00471         Surveyors
    };

    /**
     * Enum of levels of resolving when iterating through an entity tree.
     */
00477     enum ResolveLevel {
        /** Groups are not resolved */
00479         ResolveNone,
        /** (default) only Groups are resolved */
00481         ResolveGroups,
        /**
         * all Entity Containers are resolved 
         * (including Texts, Polylines, ...) 
         */
00486         ResolveAll
    };

    /**
     * Direction used for scrolling actions.
     */
00492     enum Direction {
        Up, Left, Right, Down
    };

    /**
     * Vertical alignments.
     */
00499     enum VAlign {
00500         VAlignTop,      /**< Top. */
00501         VAlignMiddle,   /**< Middle */
00502         VAlignBottom    /**< Bottom */
    };

    /**
     * Horizontal alignments.
     */
00508     enum HAlign {
00509         HAlignLeft,     /**< Left */
00510         HAlignCenter,   /**< Centered */
00511         HAlignRight     /**< Right */
    };

    /**
     * Text drawing direction.
     */
00517     enum TextDrawingDirection {
00518         LeftToRight,     /**< Left to right */
00519         TopToBottom,     /**< Top to bottom */
00520         ByStyle          /**< Inherited from associated text style */
    };

    /**
     * Line spacing style for texts.
     */
00526     enum TextLineSpacingStyle {
00527         AtLeast,        /**< Taller characters will override */
00528         Exact           /**< Taller characters will not override */
    };

    /**
     * Leader path type.
     */
00534     enum LeaderPathType {
00535         Straight,      /**< Straight line segments */
00536         Spline         /**< Splines */
    };

    /**
     * Direction for zooming actions.
     */
00542     enum ZoomDirection {
        In, Out
    };

    /**
     * Axis specification for zooming actions.
     */
00549     enum Axis {
        OnlyX, OnlyY, Both
    };

    /**
     * Snapping modes
     */
00556     enum SnapMode {
00557         SnapFree,         /**< Free positioning */
00558         SnapGrid,         /**< Snap to grid points */
00559         SnapEndpoint,     /**< Snap to endpoints */
00560         SnapMiddle,       /**< Snap to middle points */
00561         SnapCenter,       /**< Snap to centers */
00562         SnapOnEntity,     /**< Snap to the next point on an entity */
00563         SnapDist,         /**< Snap to points with a distance to an endpoint */
00564         SnapIntersection, /**< Snap to intersection */
00565         SnapIntersectionManual  /**< Snap to intersection manually */
    };

    /**
     * Snap restrictions
     */
00571     enum SnapRestriction {
00572         RestrictNothing,        /**< No restriction to snap mode */
00573         RestrictOrthogonal,     /**< Restrict to 90,180,270,0 degrees */
00574         RestrictHorizontal,     /**< Restrict to 0,180 degrees */
00575         RestrictVertical        /**< Restrict to 90,270 degrees */
    };

    /**
     * Mouse button and keyboard state for mouse events.
     */
00581     enum ButtonState {
        NoButton        = Qt::NoButton,
        LeftButton      = Qt::LeftButton,
        RightButton     = Qt::RightButton,
        MidButton       = Qt::MidButton,
        MouseButtonMask = Qt::MouseButtonMask,
        ShiftButton     = Qt::ShiftButton,
        ControlButton   = Qt::ControlButton,
        AltButton       = Qt::AltButton,
#if QT_VERSION>=0x030000
        MetaButton      = Qt::MetaButton,
#endif
        KeyButtonMask   = Qt::KeyButtonMask,
        Keypad          = Qt::Keypad
    };

    /**
     * Wrapper for Qt
     */
00600     static Qt::ButtonState rsToQtButtonState(RS2::ButtonState t) {
        return (Qt::ButtonState)t;
    }

    /**
     * Wrapper for Qt
     */
00607     static RS2::ButtonState qtToRsButtonState(Qt::ButtonState t) {
        return (RS2::ButtonState)t;
    }

    /**
     * Enum of line styles:
     */
00614     enum LineType {
00615         NoPen = 0,            /**< No line at all. */
00616         SolidLine = 1,        /**< Normal line. */

00618         DotLine = 2,          /**< Dotted line. */
00619         DotLine2 = 3,         /**< Dotted line small. */
00620         DotLineX2 = 4,        /**< Dotted line large. */

00622         DashLine = 5,         /**< Dashed line. */
00623         DashLine2 = 6,        /**< Dashed line small. */
00624         DashLineX2 = 7,       /**< Dashed line large. */

00626         DashDotLine = 8,      /**< Alternate dots and dashes. */
00627         DashDotLine2 = 9,     /**< Alternate dots and dashes small. */
00628         DashDotLineX2 = 10,   /**< Alternate dots and dashes large. */

00630         DivideLine = 11,      /**< dash, dot, dot. */
00631         DivideLine2 = 12,     /**< dash, dot, dot small. */
00632         DivideLineX2 = 13,    /**< dash, dot, dot large. */

00634         CenterLine = 14,      /**< dash, small dash. */
00635         CenterLine2 = 15,     /**< dash, small dash small. */
00636         CenterLineX2 = 16,    /**< dash, small dash large. */

00638         BorderLine = 17,      /**< dash, dash, dot. */
00639         BorderLine2 = 18,     /**< dash, dash, dot small. */
00640         BorderLineX2 = 19,    /**< dash, dash, dot large. */

00642         LineByLayer = -1,     /**< Line type defined by layer not entity */
00643         LineByBlock = -2      /**< Line type defined by block not entity */
    };

    /**
     * Wrapper for Qt
     */
00649     static Qt::PenStyle rsToQtLineType(RS2::LineType t) {
        switch (t) {
        case NoPen:
            return Qt::NoPen;
            break;
        case SolidLine:
            return Qt::SolidLine;
            break;
        case DotLine:
        case DotLine2:
        case DotLineX2:
            return Qt::DotLine;
            break;
        case DashLine:
        case DashLine2:
        case DashLineX2:
            return Qt::DashLine;
            break;
        case DashDotLine:
        case DashDotLine2:
        case DashDotLineX2:
            return Qt::DashDotLine;
            break;
        case DivideLine:
        case DivideLine2:
        case DivideLineX2:
            return Qt::DashDotDotLine;
            break;
        case CenterLine:
        case CenterLine2:
        case CenterLineX2:
            return Qt::DashDotLine;
            break;
        case BorderLine:
        case BorderLine2:
        case BorderLineX2:
            return Qt::DashDotLine;
            break;
        case LineByLayer:
        case LineByBlock:
        default:
            return Qt::SolidLine;
            break;
        }
        return Qt::SolidLine;
    }

    /**
     * Wrapper for Qt.
     */
00699     static RS2::LineType qtToRsPenStyle(Qt::PenStyle s) {
        switch (s) {
        case Qt::NoPen:
            return NoPen;
        case Qt::SolidLine:
            return SolidLine;
            break;
        case Qt::DashLine:
            return DashLine;
            break;
        case Qt::DotLine:
            return DotLine;
            break;
        case Qt::DashDotLine:
            return DashDotLine;
            break;
        case Qt::DashDotDotLine:
            return DivideLine;
            break;
        default:
            return SolidLine;
            break;
        }
        return SolidLine;
    }

    /**
     * \brief Struct that stores a line type pattern (e.g. dash dot dot).
     */
00728     struct LineTypePatternStruct {
        double* pattern;
        int num;
    }
    LineTypePattern;

    /**
     * Enum of line widths:
     */
00737     enum LineWidth {
00738         Width00 = 0,       /**< Width 1.  (0.00mm) */
00739         Width01 = 5,       /**< Width 2.  (0.05mm) */
00740         Width02 = 9,       /**< Width 3.  (0.09mm) */
00741         Width03 = 13,      /**< Width 4.  (0.13mm) */
00742         Width04 = 15,      /**< Width 5.  (0.15mm) */
00743         Width05 = 18,      /**< Width 6.  (0.18mm) */
00744         Width06 = 20,      /**< Width 7.  (0.20mm) */
00745         Width07 = 25,      /**< Width 8.  (0.25mm) */
00746         Width08 = 30,      /**< Width 9.  (0.30mm) */
00747         Width09 = 35,      /**< Width 10. (0.35mm) */
00748         Width10 = 40,      /**< Width 11. (0.40mm) */
00749         Width11 = 50,      /**< Width 12. (0.50mm) */
00750         Width12 = 53,      /**< Width 13. (0.53mm) */
00751         Width13 = 60,      /**< Width 14. (0.60mm) */
00752         Width14 = 70,      /**< Width 15. (0.70mm) */
00753         Width15 = 80,      /**< Width 16. (0.80mm) */
00754         Width16 = 90,      /**< Width 17. (0.90mm) */
00755         Width17 = 100,     /**< Width 18. (1.00mm) */
00756         Width18 = 106,     /**< Width 19. (1.06mm) */
00757         Width19 = 120,     /**< Width 20. (1.20mm) */
00758         Width20 = 140,     /**< Width 21. (1.40mm) */
00759         Width21 = 158,     /**< Width 22. (1.58mm) */
00760         Width22 = 200,     /**< Width 23. (2.00mm) */
00761         Width23 = 211,     /**< Width 24. (2.11mm) */
00762         WidthByLayer = -1, /**< Line width defined by layer not entity. */
00763         WidthByBlock = -2, /**< Line width defined by block not entity. */
00764         WidthDefault = -3  /**< Line width defaults to the predefined line width. */
    };

    /**
     * Wrapper for Qt
     */
    /*
       static int qw(RS2::LineWidth w) {
           switch (w) {
           case Width00:
               return 1;  // 0 is more accurate but quite slow
               break;
           case WidthByLayer:
           case WidthByBlock:
           case WidthDefault:
               return 1;
               break;
           case Width01:
           case Width02:
           case Width03:
           case Width04:
           case Width05:
           case Width06:
           case Width07:
           case Width08:
               return 1;
               break;
           case Width09:
           case Width10:
               return 3;
               break;
           case Width11:
               return 4;
               break;
           case Width12:
           case Width13:
               return 5;
               break;
           case Width14:
               return 6;
               break;
           case Width15:
               return 7;
               break;
           case Width16:
               return 8;
               break;
           case Width17:
               return 9;
               break;
           case Width18:
           case Width19:
               return 10;
               break;
           case Width20:
               return 12;
               break;
           case Width21:
           case Width22:
           case Width23:
           //case Width24:
               return 14;
               break;
           default:
               return (int)w;
               break;
           }
           return (int)w;
       }
    */

    /**
     * Wrapper for Qt
     */
00838     static LineWidth intToLineWidth(int w) {
            if (w==-3) {
                  return WidthDefault;
            } else if (w==-2) {
                  return WidthByBlock;
            } else if (w==-1) {
                  return WidthByLayer;
            } else if (w<3) {
                  return Width00;
            } else if (w<8) {
                  return Width01;
            } else if (w<12) {
                  return Width02;
            } else if (w<14) {
                  return Width03;
            } else if (w<17) {
                  return Width04;
            } else if (w<19) {
                  return Width05;
            } else if (w<23) {
                  return Width06;
            } else if (w<28) {
                  return Width07;
            } else if (w<33) {
                  return Width08;
            } else if (w<38) {
                  return Width09;
            } else if (w<46) {
                  return Width10;
            } else if (w<52) {
                  return Width11;
            } else if (w<57) {
                  return Width12;
            } else if (w<66) {
                  return Width13;
            } else if (w<76) {
                  return Width14;
            } else if (w<86) {
                  return Width15;
            } else if (w<96) {
                  return Width16;
            } else if (w<104) {
                  return Width17;
            } else if (w<114) {
                  return Width18;
            } else if (w<131) {
                  return Width19;
            } else if (w<150) {
                  return Width20;
            } else if (w<180) {
                  return Width21;
            } else if (w<206) {
                  return Width22;
            } else {
                  return Width23;
            }
    }

    /**
     * Enum of cursor types.
     */
00899     enum CursorType {
00900         ArrowCursor,          /**< ArrowCursor - standard arrow cursor. */
00901         UpArrowCursor,        /**< UpArrowCursor - upwards arrow. */
00902         CrossCursor,          /**< CrossCursor - crosshair. */
00903         WaitCursor,           /**< WaitCursor - hourglass/watch. */
00904         IbeamCursor,          /**< IbeamCursor - ibeam/text entry. */
00905         SizeVerCursor,        /**< SizeVerCursor - vertical resize. */
00906         SizeHorCursor,        /**< SizeHorCursor - horizontal resize. */
00907         SizeBDiagCursor,      /**< SizeBDiagCursor - diagonal resize (/). */
00908         SizeFDiagCursor,      /**< SizeFDiagCursor - diagonal resize (\). */
00909         SizeAllCursor,        /**< SizeAllCursor - all directions resize. */
00910         BlankCursor,          /**< BlankCursor - blank/invisible cursor. */
00911         SplitVCursor,         /**< SplitVCursor - vertical splitting. */
00912         SplitHCursor,         /**< SplitHCursor - horziontal splitting. */
00913         PointingHandCursor,   /**< PointingHandCursor - a pointing hand. */
00914         ForbiddenCursor,      /**< ForbiddenCursor - a slashed circle. */
00915         WhatsThisCursor,      /**< WhatsThisCursor - an arrow with a ?. */
00916         CadCursor,            /**< CadCursor - a bigger cross. */
00917         DelCursor,            /**< DelCursor - cursor for choosing entities */
00918         SelectCursor,         /**< SelectCursor - for selecting single entities */
00919         MagnifierCursor,      /**< MagnifierCursor - a magnifying glass. */
00920         MovingHandCursor      /**< Moving hand - a little flat hand. */
    };

    /**
     * Wrapper for Qt.
     */
#if QT_VERSION>=0x030000
    static Qt::CursorShape rsToQtCursorType(RS2::CursorType t) {
        switch (t) {
        case ArrowCursor:
            return Qt::ArrowCursor;
            break;
        case UpArrowCursor:
            return Qt::UpArrowCursor;
            break;
        case CrossCursor:
            return Qt::CrossCursor;
            break;
        case WaitCursor:
            return Qt::WaitCursor;
            break;
        case IbeamCursor:
            return Qt::IbeamCursor;
            break;
        case SizeVerCursor:
            return Qt::SizeVerCursor;
            break;
        case SizeHorCursor:
            return Qt::SizeHorCursor;
            break;
        case SizeBDiagCursor:
            return Qt::SizeBDiagCursor;
            break;
        case SizeFDiagCursor:
            return Qt::SizeFDiagCursor;
            break;
        case SizeAllCursor:
            return Qt::SizeAllCursor;
            break;
        case BlankCursor:
            return Qt::BlankCursor;
            break;
        case SplitVCursor:
            return Qt::SplitVCursor;
            break;
        case SplitHCursor:
            return Qt::SplitHCursor;
            break;
        case PointingHandCursor:
            return Qt::PointingHandCursor;
            break;
        case ForbiddenCursor:
            return Qt::ForbiddenCursor;
            break;
        case WhatsThisCursor:
            return Qt::WhatsThisCursor;
            break;
        default:
            return Qt::ArrowCursor;
            break;
        }
        return Qt::ArrowCursor;
    }
#endif

    /**
     * Paper formats.
     */
00988     enum PaperFormat {
        Custom, 
            Letter, 
            Legal, 
            Executive,
        A0, 
            A1,
            A2, 
            A3, 
            A4, 
            A5, 
            A6, 
            A7, 
            A8, 
            A9, 
        B0, 
            B1, 
            B2, 
            B3, 
            B4, 
            B5, 
            B6, 
            B7, 
            B8, 
            B9, 
            B10,
        C5E, 
            Comm10E,
        DLE, 
            Folio, 
            //Ledger, 
            Tabloid, 
            NPageSize 
      };
      
    /**
     * Wrapper for Qt.
     */
#if QT_VERSION>=0x030000
    static QPrinter::PageSize rsToQtPaperFormat(RS2::PaperFormat f) {
            QPrinter::PageSize ret;
      
            switch (f) {
        case Custom:
                  ret = QPrinter::Custom;
                  break;
            case Letter:
                  ret = QPrinter::Letter;
                  break;
            case Legal:
                  ret = QPrinter::Legal;
                  break;
            case Executive:
                  ret = QPrinter::Executive;
                  break;
        case A0:
                  ret = QPrinter::A0;
                  break;
            case A1:
                  ret = QPrinter::A1;
                  break;
            case A2:
                  ret = QPrinter::A2;
                  break;
            case A3:
                  ret = QPrinter::A3;
                  break;
            default:
            case A4:
                  ret = QPrinter::A4;
                  break;
            case A5:
                  ret = QPrinter::A5;
                  break;
            case A6:
                  ret = QPrinter::A6;
                  break;
            case A7:
                  ret = QPrinter::A7;
                  break;
            case A8:
                  ret = QPrinter::A8;
                  break;
            case A9:
                  ret = QPrinter::A9;
                  break;
            case B0:
                  ret = QPrinter::B0;
                  break;
            case B1:
                  ret = QPrinter::B1;
                  break;
            case B2:
                  ret = QPrinter::B2;
                  break;
            case B3:
                  ret = QPrinter::B3;
                  break;
            case B4:
                  ret = QPrinter::B4;
                  break;
            case B5:
                  ret = QPrinter::B5;
                  break;
            case B6:
                  ret = QPrinter::B6;
                  break;
            case B7:
                  ret = QPrinter::B7;
                  break;
            case B8:
                  ret = QPrinter::B8;
                  break;
            case B9:
                  ret = QPrinter::B9;
                  break;
            case B10:
                  ret = QPrinter::B10;
                  break;
            case C5E:
                  ret = QPrinter::C5E;
                  break;
            case Comm10E:
                  ret = QPrinter::Comm10E;
                  break;
        case DLE:
                  ret = QPrinter::DLE;
                  break;
            case Folio:
                  ret = QPrinter::Folio;
                  break;
            //case Ledger:
            //    ret = QPrinter::Ledger;
            //    break;
            case Tabloid:
                  ret = QPrinter::Tabloid;
                  break;
            case NPageSize:
                  ret = QPrinter::NPageSize;
                  break;
            }

            return ret;
      }
#endif

};

#endif

Generated by  Doxygen 1.6.0   Back to index