| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #include "lc_graphicvariables.h" |
| |
|
| | #include "rs_graphic.h" |
| |
|
| | LC_GraphicVariables::LC_GraphicVariables() = default; |
| |
|
| |
|
| | void LC_GraphicVariables::loadFromVars(RS_Graphic* g) { |
| | m_gridOn = g->getVariableBool("$GRIDMODE", true); |
| | m_isometricGrid = g->getVariableBool("$SNAPSTYLE", false); |
| | m_anglesBase = g->getVariableDouble("$ANGBASE",0.0); |
| | m_anglesCounterClockWise = !g->getVariableBool("$ANGDIR", false); |
| | m_dimStyle = g->getVariableString("$DIMSTYLE", "Standard"); |
| | m_gridViewType= (RS2::IsoGridViewType) g->getVariableInt("$SNAPISOPAIR", RS2::IsoGridViewType::IsoTop); |
| | m_paperInsertionBase = g->getVariableVector("$PINSBASE", RS_Vector(0.0,0.0)); |
| | m_angleFormat = angleUnitsDXF2LC(g->getVariableInt("$AUNITS", 0)); |
| | m_anglePrecision = g->getVariableInt("$AUPREC", 4); |
| | m_linearPrecision = g->getVariableInt("$LUPREC", 4); |
| | m_linearFormat = convertLinearFormatDXF2LC(g->getVariableInt("$LUNITS", 2)); |
| | m_unit = static_cast<RS2::Unit>(g->getVariableInt("$INSUNITS", 0)); |
| | } |
| |
|
| | void LC_GraphicVariables::saveToVars(RS_Graphic* g) { |
| | g->addVariable("$GRIDMODE", m_gridOn, 70); |
| | g->addVariable("$SNAPSTYLE", m_isometricGrid, 70); |
| | g->addVariable("$ANGBASE", m_isometricGrid, 50); |
| | g->addVariable("$ANGDIR", !m_anglesCounterClockWise, 70); |
| | g->addVariable("$DIMSTYLE", m_dimStyle, 2); |
| | g->addVariable("$SNAPISOPAIR", m_gridViewType, 70); |
| | g->addVariable("$PINSBASE", m_paperInsertionBase, 10); |
| | } |
| |
|
| | |
| | |
| | |
| | bool LC_GraphicVariables::isGridOn() const { |
| | return m_gridOn; |
| | } |
| |
|
| | |
| | |
| | |
| | void LC_GraphicVariables::setGridOn(bool on) { |
| | m_gridOn = on; |
| | } |
| |
|
| | |
| | |
| | |
| | bool LC_GraphicVariables::isIsometricGrid() const{ |
| | return m_isometricGrid; |
| | } |
| |
|
| | |
| | |
| | |
| | void LC_GraphicVariables::setIsometricGrid(bool on) { |
| | m_isometricGrid = on; |
| | } |
| |
|
| | double LC_GraphicVariables::getAnglesBase() const{ |
| | return m_anglesBase; |
| | } |
| |
|
| | void LC_GraphicVariables::setAnglesBase(double baseAngle){ |
| | m_anglesBase = baseAngle; |
| | } |
| |
|
| | bool LC_GraphicVariables::areAnglesCounterClockWise() const{ |
| | return m_anglesCounterClockWise; |
| | } |
| |
|
| | void LC_GraphicVariables::setAnglesCounterClockwise(bool on){ |
| | m_anglesCounterClockWise = on; |
| | } |
| |
|
| | QString LC_GraphicVariables::getDefaultDimStyleName() { |
| | return m_dimStyle; |
| | } |
| |
|
| | void LC_GraphicVariables::setDefaultDimStyleName(QString name) { |
| | m_dimStyle = name; |
| | } |
| |
|
| |
|
| | RS2::IsoGridViewType LC_GraphicVariables::getIsoView() const{ |
| | return m_gridViewType; |
| | } |
| |
|
| | void LC_GraphicVariables::setIsoView(RS2::IsoGridViewType viewType){ |
| | m_gridViewType = viewType; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | RS_Vector LC_GraphicVariables::getPaperInsertionBase() { |
| | return m_paperInsertionBase; |
| | } |
| |
|
| | void LC_GraphicVariables::setPaperInsertionBase(const RS_Vector& p) { |
| | m_paperInsertionBase = p; |
| | } |
| |
|
| | int LC_GraphicVariables::getAnglePrecision() const { |
| | return m_anglePrecision; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | int LC_GraphicVariables::getLinearPrecision() const{ |
| | return m_linearPrecision; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | RS2::AngleFormat LC_GraphicVariables::getAngleFormat() const{ |
| | return m_angleFormat; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | RS2::LinearFormat LC_GraphicVariables::getLinearFormat() const{ |
| | return m_linearFormat; |
| |
|
| | } |
| |
|
| | RS2::Unit LC_GraphicVariables::getUnit() const { |
| | return m_unit; |
| | } |
| |
|
| | |
| | |
| | |
| | RS2::LinearFormat LC_GraphicVariables::convertLinearFormatDXF2LC(int f){ |
| | switch (f) { |
| | case 1: |
| | return RS2::Scientific; |
| | case 2: |
| | return RS2::Decimal; |
| | case 3: |
| | return RS2::Engineering; |
| | case 4: |
| | return RS2::Architectural; |
| | case 5: |
| | return RS2::Fractional; |
| | case 6: |
| | return RS2::ArchitecturalMetric; |
| | default: |
| | return RS2::Decimal; |
| | } |
| | } |
| |
|
| | RS2::AngleFormat LC_GraphicVariables::angleUnitsDXF2LC(int aunits) { |
| | switch (aunits) { |
| | case 0: |
| | return RS2::DegreesDecimal; |
| | case 1: |
| | return RS2::DegreesMinutesSeconds; |
| | case 2: |
| | return RS2::Gradians; |
| | case 3: |
| | return RS2::Radians; |
| | case 4: |
| | return RS2::Surveyors; |
| | default: |
| | return RS2::DegreesDecimal; |
| | } |
| | } |
| |
|