diff --git a/GISLibrary/AlertCommands.cpp b/GISLibrary/AlertCommands.cpp
index ce540f90..4a77f08b 100644
--- a/GISLibrary/AlertCommands.cpp
+++ b/GISLibrary/AlertCommands.cpp
@@ -30,6 +30,10 @@ namespace DrawingInstructions
AlertReference::AlertReference(std::string alertReference, std::string plan, std::string monitor)
: alertReference(alertReference), plan(plan), monitor(monitor) {}
+ void AlertReference::init()
+ {
+ }
+
void AlertReference::execute() {
}
void AlertReference::parse(const std::string& input)
diff --git a/GISLibrary/AlertCommands.h b/GISLibrary/AlertCommands.h
index c94a13a0..2d997a86 100644
--- a/GISLibrary/AlertCommands.h
+++ b/GISLibrary/AlertCommands.h
@@ -5,7 +5,9 @@ namespace DrawingInstructions
{
class AlertReference : public StateCommand {
public:
+ AlertReference() = default;
AlertReference(std::string alertReference, std::string plan, std::string monitor);
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
private:
diff --git a/GISLibrary/ColourOverrideCommands.cpp b/GISLibrary/ColourOverrideCommands.cpp
index 4782a06f..4d38aab8 100644
--- a/GISLibrary/ColourOverrideCommands.cpp
+++ b/GISLibrary/ColourOverrideCommands.cpp
@@ -52,6 +52,10 @@ namespace DrawingInstructions
OverrideColor::OverrideColor(const std::string& colorToken, double colorTransparency, const std::string& overrideToken, double overrideTransparency)
: colorToken(colorToken), colorTransparency(colorTransparency), overrideToken(overrideToken), overrideTransparency(overrideTransparency) {}
+ void OverrideColor::init()
+ {
+ }
+
void OverrideColor::execute()
{
}
@@ -63,6 +67,11 @@ namespace DrawingInstructions
OverrideAll::OverrideAll(const std::string& token, double transparency)
: token(token), transparency(transparency) {}
+
+ void OverrideAll::init()
+ {
+ }
+
void OverrideAll::execute() {
}
void OverrideAll::parse(const std::string& input)
diff --git a/GISLibrary/ColourOverrideCommands.h b/GISLibrary/ColourOverrideCommands.h
index 0a714a60..5db02e95 100644
--- a/GISLibrary/ColourOverrideCommands.h
+++ b/GISLibrary/ColourOverrideCommands.h
@@ -3,9 +3,14 @@
namespace DrawingInstructions
{
- class OverrideColor : public StateCommand {
+ class OverrideColor : public StateCommand
+ {
public:
+ OverrideColor() = default;
OverrideColor(const std::string& colorToken, double colorTransparency, const std::string& overrideToken, double overrideTransparency);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -16,9 +21,14 @@ namespace DrawingInstructions
double overrideTransparency;
};
- class OverrideAll : public StateCommand {
+ class OverrideAll : public StateCommand
+ {
public:
+ OverrideAll() = default;
OverrideAll(const std::string& token, double transparency);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
diff --git a/GISLibrary/CoverageCommands.cpp b/GISLibrary/CoverageCommands.cpp
index 75831080..e3c17dea 100644
--- a/GISLibrary/CoverageCommands.cpp
+++ b/GISLibrary/CoverageCommands.cpp
@@ -71,6 +71,11 @@ namespace DrawingInstructions {
NumericAnnotation::NumericAnnotation(int decimals, const std::string& championChoice, double buffer)
: decimals(decimals), championChoice(championChoice), buffer(buffer) {}
+ void NumericAnnotation::init()
+ {
+
+ }
+
void NumericAnnotation::execute() {
}
@@ -81,6 +86,11 @@ namespace DrawingInstructions {
SymbolAnnotation::SymbolAnnotation(const std::string& symbolRef, const std::string& rotationAttribute, const std::string& scaleAttribute, const std::string& rotationCRS, double rotationOffset, double rotationFactor, double scaleFactor)
: symbolRef(symbolRef), rotationAttribute(rotationAttribute), scaleAttribute(scaleAttribute), rotationCRS(rotationCRS), rotationOffset(rotationOffset), rotationFactor(rotationFactor), scaleFactor(scaleFactor) {}
+ void SymbolAnnotation::init()
+ {
+
+ }
+
void SymbolAnnotation::execute() {
}
@@ -91,6 +101,11 @@ namespace DrawingInstructions {
CoverageColor::CoverageColor(const std::string& startToken, double startTransparency, const std::string& endToken, double endTransparency, double penWidth)
: startToken(startToken), startTransparency(startTransparency), endToken(endToken), endTransparency(endTransparency), penWidth(penWidth) {}
+ void CoverageColor::init()
+ {
+
+ }
+
void CoverageColor::execute() {
}
@@ -101,6 +116,14 @@ namespace DrawingInstructions {
LookupEntry::LookupEntry(const std::string& label, double lower, double upper, const std::string& closure)
: label(label), lower(lower), upper(upper), closure(closure) {}
+ void LookupEntry::init()
+ {
+ label = "";
+ lower = 0.0;
+ upper = 0.0;
+ closure = "";
+ }
+
void LookupEntry::execute() {
}
void LookupEntry::parse(const std::string& input)
diff --git a/GISLibrary/CoverageCommands.h b/GISLibrary/CoverageCommands.h
index f07d40b8..737778e9 100644
--- a/GISLibrary/CoverageCommands.h
+++ b/GISLibrary/CoverageCommands.h
@@ -7,8 +7,10 @@ namespace DrawingInstructions
// NumericAnnotation Class
class NumericAnnotation : public StateCommand {
public:
+ NumericAnnotation() = default;
NumericAnnotation(int decimals, const std::string& championChoice, double buffer);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -21,11 +23,12 @@ namespace DrawingInstructions
// SymbolAnnotation Class
class SymbolAnnotation : public StateCommand {
public:
+ SymbolAnnotation() = default;
SymbolAnnotation(const std::string& symbolRef, const std::string& rotationAttribute, const std::string& scaleAttribute,
const std::string& rotationCRS, double rotationOffset, double rotationFactor,
double scaleFactor);
-
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -42,8 +45,10 @@ namespace DrawingInstructions
// CoverageColor Class
class CoverageColor : public StateCommand {
public:
+ CoverageColor() = default;
CoverageColor(const std::string& startToken, double startTransparency, const std::string& endToken, double endTransparency, double penWidth);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -57,7 +62,10 @@ namespace DrawingInstructions
class LookupEntry : public StateCommand {
public:
+ LookupEntry() = default;
LookupEntry(const std::string& label, double lower, double upper, const std::string& closure);
+
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
diff --git a/GISLibrary/GF_FeatureType.cpp b/GISLibrary/GF_FeatureType.cpp
index e4934cb5..35e67752 100644
--- a/GISLibrary/GF_FeatureType.cpp
+++ b/GISLibrary/GF_FeatureType.cpp
@@ -28,51 +28,6 @@ namespace GF
if (other.spatial)
spatial = new SpatialAttributeType(*other.spatial);
-
- if (other.geometry)
- {
- switch (other.geometry->GetType())
- {
- case SGeometryType::Point:
- {
- SPoint* pt = (SPoint*)other.geometry;
- geometry = (pt) ? new SPoint(*pt) : nullptr;
- }
- break;
- case SGeometryType::CompositeCurve:
- {
- SCompositeCurve* cc = (SCompositeCurve*)other.geometry;
- geometry = (cc) ? new SCompositeCurve(*cc) : nullptr;
- }
- break;
- case SGeometryType::Surface:
- {
- SSurface* sf = (SSurface*)other.geometry;
- geometry = (sf) ? new SSurface(*sf) : nullptr;
- }
- break;
- case SGeometryType::MultiPoint:
- {
- SMultiPoint* mp = (SMultiPoint*)other.geometry;
- geometry = (mp) ? new SMultiPoint(*mp) : nullptr;
- }
- break;
- case SGeometryType::Curve:
- {
- SCurve* cv = (SCurve*)other.geometry;
- geometry = (cv) ? new SCurve(*cv) : nullptr;
- }
- break;
- case SGeometryType::Coverage:
- {
- SCoverage* cr = (SCoverage*)other.geometry;
- geometry = (cr) ? new SCoverage(*cr) : nullptr;
- }
- break;
- default:
- break;
- }
- }
}
FeatureType::~FeatureType()
diff --git a/GISLibrary/GF_NamedType.cpp b/GISLibrary/GF_NamedType.cpp
index e76f02a4..d338846f 100644
--- a/GISLibrary/GF_NamedType.cpp
+++ b/GISLibrary/GF_NamedType.cpp
@@ -8,6 +8,11 @@ namespace GF
}
+ NamedType::NamedType(std::string code)
+ {
+ this->code = code;
+ }
+
NamedType::NamedType(const NamedType& other)
{
code = other.code;
diff --git a/GISLibrary/GF_NamedType.h b/GISLibrary/GF_NamedType.h
index d6058829..6c1905d9 100644
--- a/GISLibrary/GF_NamedType.h
+++ b/GISLibrary/GF_NamedType.h
@@ -8,6 +8,7 @@ namespace GF
{
public:
NamedType();
+ NamedType(std::string code);
NamedType(const NamedType& other);
virtual ~NamedType();
diff --git a/GISLibrary/GISLibrary.vcxproj b/GISLibrary/GISLibrary.vcxproj
index 2dfddac9..735bc24e 100644
--- a/GISLibrary/GISLibrary.vcxproj
+++ b/GISLibrary/GISLibrary.vcxproj
@@ -417,6 +417,7 @@
+
@@ -758,6 +759,7 @@
+
diff --git a/GISLibrary/GISLibrary.vcxproj.filters b/GISLibrary/GISLibrary.vcxproj.filters
index 3442d87e..572fe0bc 100644
--- a/GISLibrary/GISLibrary.vcxproj.filters
+++ b/GISLibrary/GISLibrary.vcxproj.filters
@@ -1059,6 +1059,9 @@
Source Files
+
+ Source Files
+
@@ -2114,6 +2117,9 @@
Header Files
+
+ Header Files
+
diff --git a/GISLibrary/GeometryCommands.cpp b/GISLibrary/GeometryCommands.cpp
index 55604b93..91187c99 100644
--- a/GISLibrary/GeometryCommands.cpp
+++ b/GISLibrary/GeometryCommands.cpp
@@ -134,6 +134,12 @@ namespace DrawingInstructions
SpatialReference::SpatialReference(const std::string& reference, bool forward) : reference(reference), forward(forward) {}
+ void SpatialReference::init()
+ {
+ reference = "";
+ forward = false;
+ }
+
void SpatialReference::execute()
{
}
@@ -144,6 +150,13 @@ namespace DrawingInstructions
AugmentedPoint::AugmentedPoint(std::string crs, double x, double y) : crs(crs), x(x), y(y) {}
+ void AugmentedPoint::init()
+ {
+ crs = "";
+ x = 0.0;
+ y = 0.0;
+ }
+
void AugmentedPoint::execute()
{
}
@@ -154,6 +167,14 @@ namespace DrawingInstructions
AugmentedRay::AugmentedRay(std::string CRSType, double direction, std::string crsLength, double length) : CRSType(CRSType), direction(direction), crsLength(crsLength), length(length) {}
+ void AugmentedRay::init()
+ {
+ CRSType = "";
+ direction = 0.0;
+ crsLength = "";
+ length = 0.0;
+ }
+
void AugmentedRay::execute()
{
}
@@ -164,6 +185,13 @@ namespace DrawingInstructions
AugmentedPath::AugmentedPath(std::string crsPosition, std::string crsAngle, std::string crsDistance) : crsPosition(crsPosition), crsAngle(crsAngle), crsDistance(crsDistance) {}
+ void AugmentedPath::init()
+ {
+ crsPosition = "";
+ crsAngle = "";
+ crsDistance = "";
+ }
+
void AugmentedPath::execute()
{
}
@@ -174,6 +202,11 @@ namespace DrawingInstructions
Polyline::Polyline(const std::vector& points) : points(points) {}
+ void Polyline::init()
+ {
+ points.clear();
+ }
+
void Polyline::execute()
{
}
@@ -184,6 +217,16 @@ namespace DrawingInstructions
Arc3Points::Arc3Points(std::string startPointX, std::string startPointY, std::string medianPointX, std::string medianPointY, std::string endPointX, std::string endPointY) : startPointX(startPointX), startPointY(startPointY), medianPointX(medianPointX), medianPointY(medianPointY), endPointX(endPointX), endPointY(endPointY) {}
+ void Arc3Points::init()
+ {
+ startPointX = "";
+ startPointY = "";
+ medianPointX = "";
+ medianPointY = "";
+ endPointX = "";
+ endPointY = "";
+ }
+
void Arc3Points::execute()
{
}
@@ -194,6 +237,15 @@ namespace DrawingInstructions
ArcByRadius::ArcByRadius(std::string centerX, std::string centerY, double radius, double startAngle, double angularDistance) : centerX(centerX), centerY(centerY), radius(radius), startAngle(startAngle), angularDistance(angularDistance) {}
+ void ArcByRadius::init()
+ {
+ centerX = "";
+ centerY = "";
+ radius = 0.0;
+ startAngle = 0.0;
+ angularDistance = 0.0;
+ }
+
void ArcByRadius::execute()
{
}
@@ -204,6 +256,16 @@ namespace DrawingInstructions
Annulus::Annulus(std::string centerX, std::string centerY, double outerRadius, double innerRadius, double startAngle, double angularDistance) : centerX(centerX), centerY(centerY), outerRadius(outerRadius), innerRadius(innerRadius), startAngle(startAngle), angularDistance(angularDistance) {}
+ void Annulus::init()
+ {
+ centerX = "";
+ centerY = "";
+ outerRadius = 0.0;
+ innerRadius = 0.0;
+ startAngle = 0.0;
+ angularDistance = 0.0;
+ }
+
void Annulus::execute()
{
}
@@ -212,6 +274,9 @@ namespace DrawingInstructions
{
}
+ void ClearGeometry::init()
+ {
+ }
void ClearGeometry::execute()
{
diff --git a/GISLibrary/GeometryCommands.h b/GISLibrary/GeometryCommands.h
index fd2ecaff..68fa6a06 100644
--- a/GISLibrary/GeometryCommands.h
+++ b/GISLibrary/GeometryCommands.h
@@ -7,8 +7,10 @@ namespace DrawingInstructions
class SpatialReference : public StateCommand {
public:
+ SpatialReference() = default;
SpatialReference(const std::string& reference, bool forward);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -19,8 +21,10 @@ namespace DrawingInstructions
class AugmentedPoint : public StateCommand {
public:
+ AugmentedPoint() = default;
AugmentedPoint(std::string crs, double x, double y);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -32,8 +36,10 @@ namespace DrawingInstructions
class AugmentedRay : public StateCommand {
public:
+ AugmentedRay() = default;
AugmentedRay(std::string CRSType, double direction, std::string crsLength, double length);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -46,8 +52,10 @@ namespace DrawingInstructions
class AugmentedPath : public StateCommand {
public:
+ AugmentedPath() = default;
AugmentedPath(std::string crsPosition, std::string crsAngle, std::string crsDistance);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -60,8 +68,10 @@ namespace DrawingInstructions
// Polyline class
class Polyline : public StateCommand {
public:
+ Polyline() = default;
Polyline(const std::vector& points);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -72,8 +82,10 @@ namespace DrawingInstructions
// Arc3Points class
class Arc3Points : public StateCommand {
public:
+ Arc3Points() = default;
Arc3Points(std::string startPointX, std::string startPointY, std::string medianPointX, std::string medianPointY, std::string endPointX, std::string endPointY);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -90,8 +102,10 @@ namespace DrawingInstructions
// ArcByRadius class
class ArcByRadius : public StateCommand {
public:
+ ArcByRadius() = default;
ArcByRadius(std::string centerX, std::string centerY, double radius, double startAngle, double angularDistance);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -108,6 +122,7 @@ namespace DrawingInstructions
public:
Annulus(std::string centerX, std::string centerY, double outerRadius, double innerRadius, double startAngle, double angularDistance);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -124,6 +139,7 @@ namespace DrawingInstructions
public:
ClearGeometry() = default;
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
};
diff --git a/GISLibrary/LayerManager.cpp b/GISLibrary/LayerManager.cpp
index 1945a6c0..ccfa0b2b 100644
--- a/GISLibrary/LayerManager.cpp
+++ b/GISLibrary/LayerManager.cpp
@@ -1221,6 +1221,10 @@ void LayerManager::DrawS100Layer(HDC& hDC, int offset, S100Layer* layer, int min
}
auto pc = layer->GetPC();
+ if (nullptr == pc)
+ {
+ return;
+ }
auto rt = D2->pRT;
rt->BindDC(hDC, scaler->GetScreenRect());
diff --git a/GISLibrary/LineStyleCommands.cpp b/GISLibrary/LineStyleCommands.cpp
index 33c3c64b..eb0ff4e8 100644
--- a/GISLibrary/LineStyleCommands.cpp
+++ b/GISLibrary/LineStyleCommands.cpp
@@ -1,6 +1,8 @@
#include "stdafx.h"
#include "LineStyleCommands.h"
+#include "..\\LatLonUtility\\LatLonUtility.h"
+
namespace DrawingInstructions
{
LineStyleCommands::~LineStyleCommands()
@@ -20,7 +22,7 @@ namespace DrawingInstructions
this->lineStyle = new LineStyle(name, intervalLength, width, token, transparency, capStyle, joinStyle, offset);
}
- void LineStyleCommands::setLineSymbol(const std::string& Reference, double position, double rotation, const std::string& crsType)
+ void LineStyleCommands::setLineSymbol(const std::string& Reference, double position, double rotation, const GraphicBasePackage::CRSType crsType)
{
delete this->lineSymbol;
this->lineSymbol = new LineSymbol(Reference, position, rotation, crsType);
@@ -57,6 +59,18 @@ namespace DrawingInstructions
LineStyle::LineStyle(const std::string& name, double intervalLength, double width, const std::string& token, double transparency, const std::string& capStyle, const std::string& joinStyle, double offset)
: name(name), intervalLength(intervalLength), width(width), token(token), transparency(transparency), capStyle(capStyle), joinStyle(joinStyle), offset(offset) {}
+ void LineStyle::init()
+ {
+ name = "";
+ intervalLength = 0.0;
+ width = 0.0;
+ token = "";
+ transparency = 0.0;
+ capStyle = "Butt";
+ joinStyle = "Miter";
+ offset = 0.0;
+ }
+
void LineStyle::execute()
{
// Execute LineStyle
@@ -64,10 +78,55 @@ namespace DrawingInstructions
void LineStyle::parse(const std::string& input)
{
+ std::vector values = LatLonUtility::Split(input, ",");
+ if (values.size() >= 4)
+ {
+ name = values[0];
+ try
+ {
+ intervalLength = std::stod(values[1]);
+ width = std::stod(values[2]);
+ token = values[3];
+
+ if (values.size() >= 5)
+ {
+ transparency = std::stod(values[4]);
+ }
+ if (values.size() >= 6)
+ {
+ capStyle = values[5];
+ }
+ if (values.size() >= 7)
+ {
+ joinStyle = values[6];
+ }
+ if (values.size() >= 8)
+ {
+ offset = std::stod(values[7]);
+ }
+ }
+ catch (const std::exception& e)
+ {
+ init();
+ }
+ }
+ else
+ {
+ init();
+ }
}
- LineSymbol::LineSymbol(const std::string& Reference, double position, double rotation, const std::string& crsType)
- : Reference(Reference), position(position), rotation(rotation), crsType(crsType) {}
+ LineSymbol::LineSymbol(const std::string& Reference, double position, double rotation, const GraphicBasePackage::CRSType crsType)
+ : reference(Reference), position(position), rotation(rotation), crsType(crsType) {}
+
+ void LineSymbol::init()
+ {
+ reference = "";
+ position = 0.0;
+ rotation = 0.0;
+ crsType = GraphicBasePackage::CRSType::localCRS;
+ scaleFactor = 1.0;
+ }
void LineSymbol::execute()
{
@@ -76,16 +135,76 @@ namespace DrawingInstructions
void LineSymbol::parse(const std::string& input)
{
+ std::vector values = LatLonUtility::Split(input, ",");
+ if (values.size() >= 2)
+ {
+ reference = values[0];
+ try
+ {
+ position = std::stod(values[1]);
+ if (values.size() >= 3)
+ {
+ rotation = std::stod(values[2]);
+ }
+ if (values.size() >= 4)
+ {
+ if (values[3].compare("LocalCRS") == 0)
+ {
+ crsType = GraphicBasePackage::CRSType::localCRS;
+ }
+ else if (values[3].compare("LineCRS") == 0)
+ {
+ crsType = GraphicBasePackage::CRSType::lineCRS;
+ }
+ else if (values[3].compare("PortrayalCRS") == 0)
+ {
+ crsType = GraphicBasePackage::CRSType::portrayalCRS;
+ }
+ }
+ if (values.size() >= 5)
+ {
+ scaleFactor = std::stod(values[4]);
+ }
+ }
+ catch (const std::exception& e)
+ {
+ init();
+ }
+
+ if (values.size() >= 3)
+ {
+
+ }
+ } else {
+ init();
+ }
}
Dash::Dash(double start, double length)
: start(start), length(length) {}
+ void Dash::init()
+ {
+ start = 0.0;
+ length = 0.0;
+ }
+
void Dash::execute()
{
// Execute Dash
}
void Dash::parse(const std::string& input)
{
+ std::vector values = LatLonUtility::Split(input, ",");
+ if (values.size() == 2) {
+ try {
+ start = std::stod(values[0]);
+ length = std::stod(values[1]);
+ } catch (const std::exception& e) {
+ init();
+ }
+ } else {
+ init();
+ }
}
}
\ No newline at end of file
diff --git a/GISLibrary/LineStyleCommands.h b/GISLibrary/LineStyleCommands.h
index ed4a4f02..8ab0505a 100644
--- a/GISLibrary/LineStyleCommands.h
+++ b/GISLibrary/LineStyleCommands.h
@@ -1,48 +1,58 @@
#pragma once
+
#include "StateCommand.h"
+#include "..\\S100Engine\\GraphicBasePackage_Enum.h"
+
namespace DrawingInstructions
{
- class LineStyle : public StateCommand {
+ class LineStyle : public StateCommand
+ {
public:
+ LineStyle() = default;
LineStyle(const std::string& name, double intervalLength, double width, const std::string& token, double transparency,
const std::string& capStyle, const std::string& joinStyle, double offset);
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
private:
std::string name;
- double intervalLength;
- double width;
+ double intervalLength = 0.0;
+ double width = 0.0;
std::string token;
- double transparency;
- std::string capStyle;
- std::string joinStyle;
- double offset;
+ double transparency = 0.0;
+ std::string capStyle = "Butt";
+ std::string joinStyle = "Miter";
+ double offset = 0.0;
};
class LineSymbol : public StateCommand {
public:
- LineSymbol(const std::string& Reference, double position, double rotation, const std::string& crsType);
-
+ LineSymbol() = default;
+ LineSymbol(const std::string& Reference, double position, double rotation, const GraphicBasePackage::CRSType crsType);
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
private:
- std::string Reference;
- double position;
- double rotation;
- std::string crsType;
+ std::string reference;
+ double position = 0.0;
+ double rotation = 0.0;
+ GraphicBasePackage::CRSType crsType = GraphicBasePackage::CRSType::localCRS;
+ double scaleFactor = 1.0;
};
- class Dash : public StateCommand {
+ class Dash : public StateCommand
+ {
public:
+ Dash() = default;
Dash(double start, double length);
-
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
private:
- double start;
- double length;
+ double start = 0.0;
+ double length = 0.0;
};
class LineStyleCommands
@@ -57,7 +67,7 @@ namespace DrawingInstructions
void setLineStyle(const std::string& name, double intervalLength, double width, const std::string& token, double transparency,
const std::string& capStyle, const std::string& joinStyle, double offset);
- void setLineSymbol(const std::string& Reference, double position, double rotation, const std::string& crsType);
+ void setLineSymbol(const std::string& Reference, double position, double rotation, const GraphicBasePackage::CRSType crsType);
void setDash(double start, double length);
diff --git a/GISLibrary/ProcessS101.cpp b/GISLibrary/ProcessS101.cpp
index a2e711f9..82e36bd8 100644
--- a/GISLibrary/ProcessS101.cpp
+++ b/GISLibrary/ProcessS101.cpp
@@ -45,6 +45,78 @@ using namespace LatLonUtility;
S101LuaScriptingReference ProcessS101::theInstance;
std::string ProcessS101::g_unknown_attribute_value = "";
+void Local_StateCommands::Init()
+{
+ // Visibility
+ v_ViewingGroup.clear();
+ v_DisplayPlane = "";
+ v_DrawingPriority = "0";
+ v_ScaleMinimum = std::to_string(INT32_MAX);
+ v_ScaleMaximum = std::to_string(INT32_MIN);
+ v_Id = "";
+ v_Parent = "";
+ v_Hover = "false";
+
+ // Transform
+ v_LocalOffset;
+ v_LinePlacement;
+ v_AreaPlacement;
+ v_AreaCRS;
+ v_Rotation;
+ v_ScaleFactor;
+
+ // Line Style
+ v_LineStyle;
+ v_LineSymbol;
+ v_Dash;
+
+ // Text Style
+ v_FontColor;
+ v_FontSize = "10";
+ v_FontProportion;
+ v_FontWeight;
+ v_FontSlant;
+ v_FontSerifs;
+ v_FontUnderline;
+ v_FontStrikethrough;
+ v_FontUpperline;
+ v_FontReference;
+ v_TextAlignHorizontal;
+ v_TextAlignVertical;
+ v_TextVerticalOffset;
+
+ // Colour Override
+ v_OverrideColor;
+ v_OverrideAll;
+
+ // Geometry
+ v_SpatialReference;
+ v_AugmentedPoint;
+ v_AugmentedRay;
+ v_AugmentedPath;
+ v_Polyline;
+ v_Arc3Points;
+ v_ArcByRadius;
+ v_Annulus;
+ v_ClearAugmented;
+
+ // Coverage
+ v_LookupEntry;
+ v_NumericAnnotation;
+ v_SymbolAnnotation;
+ v_CoverageColor;
+
+ // Time
+ Date;
+ Time;
+ DateTime;
+ TimeValid;
+ ClearTime;
+
+ // Alert
+ v_AlertReference;
+}
+
ProcessS101::ProcessS101()
{
@@ -108,10 +180,10 @@ int ProcessS101::ProcessS101_LUA(std::wstring luaRulePath, S100Layer* layer)
for (auto i = drawingInstructionResult->begin(); i != drawingInstructionResult->end(); i++)
{
- std::string drawingInstructions = i->drawingInstructions;
- std::vector di_splited = Split(drawingInstructions, ";");
+ //std::string drawingInstructions = i->drawingInstructions;
+ //std::vector di_splited = Split(drawingInstructions, ";");
- LUA_ParsingDrawingInstructions(i->featureID, di_splited, c->pcManager);
+ LUA_ParsingDrawingInstructions(i->featureID, i->drawingInstructions, c->pcManager);
}
c->pcManager->GenerateSENCInstruction(c, layer->GetPC());
@@ -233,85 +305,394 @@ std::string ProcessS101::ProcessS100_XSLT(std::string inputXmlContent, std::stri
return result;
}
-bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vector elements, PCOutputSchemaManager* pcm)
+bool ProcessS101::LUA_ParsingDrawingInstructions(std::string_view featureID, std::string_view drawingCommands, PCOutputSchemaManager* pcm)
{
- // Visibility
- std::string v_ViewingGroup;
- std::string v_DisplayPlane;
- std::string v_DrawingPriority;
- std::string v_ScaleMinimum;
- std::string v_ScaleMaximum;
-
- // Transform
- std::string v_LocalOffset;
- std::string v_LinePlacement;
- std::string v_AreaPlacement;
- std::string v_AreaCRS;
- std::string v_Rotation;
- std::string v_ScaleFactor;
-
- // Pen Style
- std::string v_PenColor;
- std::string v_PenWidth;
-
- // Line Style
- std::string v_LineStyle;
- std::string v_LineSymbol;
- std::string v_Dash;
-
- // Text Style
- std::string v_FontColor;
- std::string v_FontSize = "10";
- std::string v_FontProportion;
- std::string v_FontWeight;
- std::string v_FontSlant;
- std::string v_FontSerifs;
- std::string v_FontUnderline;
- std::string v_FontStrikethrough;
- std::string v_FontUpperline;
- std::string v_FontReference;
- std::string v_TextAlignHorizontal;
- std::string v_TextAlignVertical;
- std::string v_TextVerticalOffset;
+ if (featureID == "195")
+ {
+ OutputDebugString(L"Feature ID 195 encountered.");
+ }
- // Colour Override
- std::string v_OverrideColor;
- std::string v_OverrideAll;
+ std::vector elements;
+ Split(drawingCommands, ";", elements);
- // Geometry
- std::string v_SpatialReference;
- std::string v_AugmentedPoint;
- std::string v_AugmentedRay;
- std::string v_AugmentedPath;
- std::string v_Polyline;
- std::string v_Arc3Points;
- std::string v_ArcByRadius;
- std::string v_Annulus;
- std::string v_ClearAugmented;
-
- // Coverage
- std::string v_LookupEntry;
- std::string v_NumericAnnotation;
- std::string v_SymbolAnnotation;
- std::string v_CoverageColor;
+ Local_StateCommands stateCommands;
std::string v_ColorFill;
std::string v_TextInstruction;
std::string v_LineInstruction;
std::string v_PointInstruction;
- std::list vl_SpatialReference;
+ std::list vl_SpatialReference;
std::string v_AreaFillReference;
- std::string v_AlertReference;
S100_Dash dash;
S100_LineStyle lineStyle;
for (auto i = elements.begin(); i != elements.end(); i++)
{
- std::string element = *i;
- std::vector di_splited = Split(element, ":");
+ std::vector di_splited;
+ std::vector cp = Split(i->data(), ":");;
+ Split(*i, ":", di_splited);
int splitedSize = (int)di_splited.size();
+ //if (splitedSize > 0)
+ //{
+ // if (di_splited[0].compare("PointInstruction") == 0)
+ // {
+
+ // }
+ // else if (di_splited[0].compare("LineInstruction") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // v_LineInstruction = di_splited[1];
+ // stateCommands.v_LineStyle = v_LineInstruction;
+ // lineStyle.ParseValue(v_LineInstruction);
+ // }
+ // }
+ // else if (di_splited[0].compare("LineInstructionUnsuppressed") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // v_LineInstruction = di_splited[1];
+ // stateCommands.v_LineStyle = v_LineInstruction;
+ // lineStyle.ParseValue(v_LineInstruction);
+ // }
+ // }
+ // else if (di_splited[0].compare("ColorFill") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // v_ColorFill = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("AreaFillReference") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // v_AreaFillReference = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("PixmapFill") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("SymbolFill") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("HatchFill") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("TextInstruction") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // v_TextInstruction = di_splited[1];
+ // stateCommands.v_TextAlignHorizontal = v_TextInstruction;
+ // }
+ // }
+ // else if (di_splited[0].compare("CoverageFill") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("NullInstruction") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("ViewingGroup") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.viewingGroup.parse(cp[1]);
+ // }
+ // }
+ // else if (di_splited[0].compare("DisplayPlane") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_DisplayPlane = di_splited[1];
+ // //stateCommands.displayPlane.ParseValue(stateCommands.v_DisplayPlane);
+ // }
+ // }
+ // else if (di_splited[0].compare("DrawingPlane") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("DrawingGroup") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("DrawingPriority") == 0)
+ // {
+
+ // }
+ // else if (di_splited[0].compare("ScaleMinimum") == 0)
+ // {
+
+ // }
+ // else if (di_splited[0].compare("ScaleMaximum") == 0)
+ // {
+
+ // }
+ // else if (di_splited[0].compare("Id") == 0)
+ // {
+
+ // }
+ // else if (di_splited[0].compare("Parent") == 0)
+ // {
+
+ // }
+ // else if (di_splited[0].compare("Hover") == 0)
+ // {
+
+ // }
+ // else if (di_splited[0].compare("LocalOffset") == 0)
+ // {
+
+ // }
+ // else if (di_splited[0].compare("LinePlacement") == 0)
+ // {
+
+ // }
+ // else if (di_splited[0].compare("AreaPlacement") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("AreaCRS") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("Rotation") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("ScaleFactor") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("LineStyle") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_LineStyle = di_splited[1];
+ // lineStyle.ParseValue(stateCommands.v_LineStyle);
+ // if (false == dash.IsEmpty())
+ // {
+ // lineStyle.SetDash(&dash);
+ // dash.SetEmpty();
+ // }
+ // }
+ // }
+ // else if (di_splited[0].compare("LineSymbol") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("Dash") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_Dash = di_splited[1];
+ // dash.ParseValue(stateCommands.v_Dash);
+ // }
+ // }
+ // else if (di_splited[0].compare("FontColor") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_FontColor = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("FontSize") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_FontSize = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("FontProportion") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("FontWeight") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("FontSlant") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_FontSlant = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("FontSerifs") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("FontUnderline") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("FontStrikethrough") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("FontUpperline") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("FontReference") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_FontReference = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("TextAlignHorizontal") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_TextAlignHorizontal = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("TextAlignVertical") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_TextAlignVertical = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("TextVerticalOffset") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_TextVerticalOffset = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("OverrideColor") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_OverrideColor = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("OverrideAll") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_OverrideAll = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("SpatialReference") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // std::string_view spatialRef = di_splited[1];
+ // if (!spatialRef.empty())
+ // {
+ // //stateCommands.v_SpatialReference.push_back(spatialRef);
+ // }
+ // }
+ // }
+ // else if (di_splited[0].compare("AugmentedPoint") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_AugmentedPoint;
+ // }
+ // }
+ // else if (di_splited[0].compare("AugmentedRay") == 0)
+ // {
+
+ // }
+ // else if (di_splited[0].compare("AugmentedPath") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_AugmentedPath = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("Polyline") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_Polyline = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("Arc3Points") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_Arc3Points = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("ArcByRadius") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_ArcByRadius = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("Annulus") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_Annulus = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("ClearAugmented") == 0)
+ // {
+ // stateCommands.v_ClearAugmented = di_splited[1];
+ // }
+ // else if (di_splited[0].compare("LookupEntry") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_LookupEntry = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("NumericAnnotation") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_NumericAnnotation = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("SymbolAnnotation") == 0)
+ // {
+ // }
+ // else if (di_splited[0].compare("CoverageColor") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_CoverageColor = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("Date") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.Date = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("Time") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.Time = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("DateTime") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.DateTime = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("TimeValid") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.TimeValid = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("ClearTime") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.ClearTime = di_splited[1];
+ // }
+ // }
+ // else if (di_splited[0].compare("AlertReference") == 0)
+ // {
+ // if (splitedSize > 1)
+ // {
+ // stateCommands.v_AlertReference = di_splited[1];
+ // }
+ // }
+ //}
if (splitedSize == 1)
{
@@ -319,23 +700,27 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
// "ClearGeometry"
if (di_splited[0].compare("ClearGeometry") == 0)
{
- v_AugmentedPoint = "";
+ stateCommands.v_AugmentedPoint = "";
vl_SpatialReference.clear();
v_AreaFillReference = "";
- v_AugmentedRay = "";
- v_AugmentedPath = "";
- v_ArcByRadius = "";
+ stateCommands.v_AugmentedRay = "";
+ stateCommands.v_AugmentedPath = "";
+ stateCommands.v_ArcByRadius = "";
}
}
else
{
// Splited Size 2
- std::string tag = di_splited[0];
- std::string value = di_splited[1];
+ std::string_view tag = di_splited[0];
+ std::string_view value = di_splited[1];
int sizeForIndex = (int)tag.size();
- if (sizeForIndex == 2)
+ if (tag.compare("TextVerticalOffset") == 0)
+ {
+ OutputDebugString(L"A");
+ }
+ else if (sizeForIndex == 2)
{
}
else if (sizeForIndex == 4)
@@ -343,15 +728,9 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
// "Dash:0,3.6"
if (tag.compare("Dash") == 0)
{
- v_Dash = value;
+ stateCommands.v_Dash = value;
dash.ParseValue(value);
}
- else
- {
- CString str;
- str.Format(_T("Lua Parser error - %S(%d)"), tag.c_str(), sizeForIndex);
- //OutputDebugString(str);
- }
}
else if (sizeForIndex == 5)
{
@@ -370,18 +749,12 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
// "FontSize:10"
if (tag.compare("FontSize") == 0)
{
- v_FontSize = value;
+ stateCommands.v_FontSize = value;
}
// "Rotation:PortrayalCRS,135"
else if (tag.compare("Rotation") == 0)
{
- v_Rotation = value;
- }
- else
- {
- CString str;
- str.Format(_T("Lua Parser error - %S(%d)"), tag.c_str(), sizeForIndex);
- //OutputDebugString(str);
+ stateCommands.v_Rotation = value;
}
}
else if (sizeForIndex == 7)
@@ -401,10 +774,10 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
pcm->displayList->SetDisplayInstruction((S100_Instruction*)in);
in->SetFeatureReference(std::wstring(featureID.begin(), featureID.end()));
- in->SetDrawingPriority(LUA_GetPriority(v_DrawingPriority));
- in->SetDisplayPlane(std::wstring(v_DisplayPlane.begin(), v_DisplayPlane.end()));
- in->SetViewingGroup(std::wstring(v_ViewingGroup.begin(), v_ViewingGroup.end()));
- in->SetScaleMinimum(std::wstring(v_ScaleMinimum.begin(), v_ScaleMinimum.end()));
+ in->SetDrawingPriority(LUA_GetPriority(stateCommands.v_DrawingPriority));
+ in->SetDisplayPlane(std::wstring(stateCommands.v_DisplayPlane.begin(), stateCommands.v_DisplayPlane.end()));
+ in->SetViewingGroup(stateCommands.v_ViewingGroup);
+ in->SetScaleMinimum(std::wstring(stateCommands.v_ScaleMinimum.begin(), stateCommands.v_ScaleMinimum.end()));
if (v_ColorFill.size() > 0)
{
@@ -426,7 +799,7 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
}
else if (tag.compare("LineStyle") == 0)
{
- v_LineStyle = value;
+ stateCommands.v_LineStyle = value;
lineStyle.ParseValue(value);
if (false == dash.IsEmpty())
@@ -437,17 +810,11 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
}
else if (tag.compare("FontColor") == 0)
{
- v_FontColor = value;
+ stateCommands.v_FontColor = value;
}
else if (tag.compare("FontSlant") == 0)
{
- v_FontSlant = value;
- }
- else
- {
- CString str;
- str.Format(_T("Lua Parser error - %S(%d)"), tag.c_str(), sizeForIndex);
- //OutputDebugString(str);
+ stateCommands.v_FontSlant = value;
}
}
else if (sizeForIndex == 11)
@@ -455,23 +822,17 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
// "LocalOffset:-3.51,3.51"
if (tag.compare("LocalOffset") == 0)
{
- v_LocalOffset = value;
+ stateCommands.v_LocalOffset = value;
}
// "ScaleFactor:0.311"
else if (tag.compare("ScaleFactor") == 0)
{
- v_ScaleFactor = value;
+ stateCommands.v_ScaleFactor = value;
}
// "ArcByRadius:0,0,20,24,199"
else if (tag.compare("ArcByRadius") == 0)
{
- v_ArcByRadius = value;
- }
- else
- {
- CString str;
- str.Format(_T("Lua Parser error - %S(%d)"), tag.c_str(), sizeForIndex);
- //OutputDebugString(str);
+ stateCommands.v_ArcByRadius = value;
}
}
else if (sizeForIndex == 12)
@@ -479,58 +840,46 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
// "ScaleMinimum:179999"
if (tag.compare("ScaleMinimum") == 0)
{
- v_ScaleMinimum = value;
+ stateCommands.v_ScaleMinimum = value;
}
// "ViewingGroup:27020"
else if (tag.compare("ViewingGroup") == 0)
{
- v_ViewingGroup = value;
+ stateCommands.v_ViewingGroup.push_back(value);
}
// "DisplayPlane:OverRADAR"
else if (tag.compare("DisplayPlane") == 0)
{
- v_DisplayPlane = value;
+ stateCommands.v_DisplayPlane = value;
}
// "AugmentedRay:GeographicCRS,24,GeographicCRS,16668"
else if (tag.compare("AugmentedRay") == 0)
{
- v_AugmentedRay = value;
+ stateCommands.v_AugmentedRay = value;
- v_AugmentedPath = "";
- }
- else
- {
- CString str;
- str.Format(_T("Lua Parser error - %S(%d)"), tag.c_str(), sizeForIndex);
- //OutputDebugString(str);
+ stateCommands.v_AugmentedPath = "";
}
}
else if (sizeForIndex == 13)
{
if (tag.compare("LinePlacement") == 0)
{
- v_LinePlacement = value;
+ stateCommands.v_LinePlacement = value;
}
else if (tag.compare("AugmentedPath") == 0)
{
- v_AugmentedPath = value;
- v_AugmentedRay = "";
+ stateCommands.v_AugmentedPath = value;
+ stateCommands.v_AugmentedRay = "";
}
else if (tag.compare("AreaPlacement") == 0)
{
}
- else
- {
- CString str;
- str.Format(_T("Lua Parser error - %S(%d)"), tag.c_str(), sizeForIndex);
- //OutputDebugString(str);
- }
}
else if (sizeForIndex == 14)
{
if (tag.compare("AugmentedPoint") == 0)
{
- v_AugmentedPoint = value;
+ stateCommands.v_AugmentedPoint = value;
}
else if (tag.compare("AlertReference") == 0)
{
@@ -559,19 +908,13 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
//v_AlertReference = "";
}
- else
- {
- CString str;
- str.Format(_T("Lua Parser error - %S(%d)"), tag.c_str(), sizeForIndex);
- //OutputDebugString(str);
- }
}
else if (sizeForIndex == 15)
{
// "DrawingPriority:8"
if (tag.compare("DrawingPriority") == 0)
{
- v_DrawingPriority = value;
+ stateCommands.v_DrawingPriority = value;
}
// "TextInstruction:bn Alligator River Light 16,21,8"
else if (tag.compare("TextInstruction") == 0)
@@ -581,27 +924,27 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
pcm->displayList->SetDisplayInstruction((S100_Instruction*)in);
in->SetFeatureReference(std::wstring(featureID.begin(), featureID.end()));
- in->SetDrawingPriority(LUA_GetPriority(v_DrawingPriority));
- in->SetDisplayPlane(std::wstring(v_DisplayPlane.begin(), v_DisplayPlane.end()));
- in->SetViewingGroup(std::wstring(v_ViewingGroup.begin(), v_ViewingGroup.end()));
- in->SetScaleMinimum(std::wstring(v_ScaleMinimum.begin(), v_ScaleMinimum.end()));
+ in->SetDrawingPriority(LUA_GetPriority(stateCommands.v_DrawingPriority));
+ in->SetDisplayPlane(std::wstring(stateCommands.v_DisplayPlane.begin(), stateCommands.v_DisplayPlane.end()));
+ in->SetViewingGroup(stateCommands.v_ViewingGroup);
+ in->SetScaleMinimum(std::wstring(stateCommands.v_ScaleMinimum.begin(), stateCommands.v_ScaleMinimum.end()));
in->SetTextPoint(new S100_TextPoint());
- if (v_TextAlignVertical.size() > 0)
+ if (stateCommands.v_TextAlignVertical.size() > 0)
{
- in->GetTextPoint()->SetVerticalAlignment(std::wstring(v_TextAlignVertical.begin(), v_TextAlignVertical.end()));
+ in->GetTextPoint()->SetVerticalAlignment(std::wstring(stateCommands.v_TextAlignVertical.begin(), stateCommands.v_TextAlignVertical.end()));
}
- if (v_TextAlignHorizontal.size() > 0)
+ if (stateCommands.v_TextAlignHorizontal.size() > 0)
{
- in->GetTextPoint()->SetHorizontalAlignment(std::wstring(v_TextAlignHorizontal.begin(), v_TextAlignHorizontal.end()));
+ in->GetTextPoint()->SetHorizontalAlignment(std::wstring(stateCommands.v_TextAlignHorizontal.begin(), stateCommands.v_TextAlignHorizontal.end()));
}
- if (v_LocalOffset.size() > 0)
+ if (stateCommands.v_LocalOffset.size() > 0)
{
in->GetTextPoint()->SetOffset(new S100_VectorPoint());
- std::vector v_splited = Split(v_LocalOffset, ",");
+ std::vector v_splited = Split(stateCommands.v_LocalOffset, ",");
if (v_splited.size() == 2)
{
in->GetTextPoint()->GetOffset()->SetX(std::wstring(v_splited[0].begin(), v_splited[0].end()));
@@ -637,25 +980,25 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
delete[] wValue;
element->GetText()->SetValue(wstrValue);
- if (v_FontSize.size() > 0)
+ if (stateCommands.v_FontSize.size() > 0)
{
- element->SetBodySize(std::wstring(v_FontSize.begin(), v_FontSize.end()));
+ element->SetBodySize(std::wstring(stateCommands.v_FontSize.begin(), stateCommands.v_FontSize.end()));
}
- if (v_FontSlant.size() > 0)
+ if (stateCommands.v_FontSlant.size() > 0)
{
if (!element->GetFont())
{
element->SetFont(new S100_Font());
}
- element->GetFont()->SetSlant(std::wstring(v_FontSlant.begin(), v_FontSlant.end()));
+ element->GetFont()->SetSlant(std::wstring(stateCommands.v_FontSlant.begin(), stateCommands.v_FontSlant.end()));
}
- if (v_FontColor.size() > 0)
+ if (stateCommands.v_FontColor.size() > 0)
{
auto fontColor = new S100_Foreground();
- fontColor->fromDrawingCommand(v_FontColor);
+ fontColor->fromDrawingCommand(stateCommands.v_FontColor);
element->SetForground(fontColor);
}
}
@@ -666,25 +1009,25 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
{
v_LineInstruction = value;
- if (v_AugmentedRay.size() > 0)
+ if (stateCommands.v_AugmentedRay.size() > 0)
{
S100_AugmentedRay *in = new S100_AugmentedRay();
pcm->displayList->SetDisplayInstruction((S100_Instruction*)in);
in->SetFeatureReference(std::wstring(featureID.begin(), featureID.end()));
- in->SetDrawingPriority(LUA_GetPriority(v_DrawingPriority));
- in->SetDisplayPlane(std::wstring(v_DisplayPlane.begin(), v_DisplayPlane.end()));
- in->SetViewingGroup(std::wstring(v_ViewingGroup.begin(), v_ViewingGroup.end()));
- in->SetScaleMinimum(std::wstring(v_ScaleMinimum.begin(), v_ScaleMinimum.end()));
+ in->SetDrawingPriority(LUA_GetPriority(stateCommands.v_DrawingPriority));
+ in->SetDisplayPlane(std::wstring(stateCommands.v_DisplayPlane.begin(), stateCommands.v_DisplayPlane.end()));
+ in->SetViewingGroup(stateCommands.v_ViewingGroup);
+ in->SetScaleMinimum(std::wstring(stateCommands.v_ScaleMinimum.begin(), stateCommands.v_ScaleMinimum.end()));
if (false == lineStyle.IsEmpty())
{
in->SetLineStyle(new S100_LineStyle(lineStyle));
}
- if (v_AugmentedRay.size() > 0)
+ if (stateCommands.v_AugmentedRay.size() > 0)
{
- std::vector v_splited = Split(v_AugmentedRay, ",");
+ std::vector v_splited = Split(stateCommands.v_AugmentedRay, ",");
if (v_splited.size() == 4)
{
in->SetDirection(std::wstring(v_splited[1].begin(), v_splited[1].end()));
@@ -692,25 +1035,25 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
}
}
}
- else if (v_AugmentedPath.size() > 0)
+ else if (stateCommands.v_AugmentedPath.size() > 0)
{
S100_AugmentedPath *in = new S100_AugmentedPath();
pcm->displayList->SetDisplayInstruction((S100_Instruction*)in);
in->SetFeatureReference(std::wstring(featureID.begin(), featureID.end()));
- in->SetDrawingPriority(LUA_GetPriority(v_DrawingPriority));
- in->SetDisplayPlane(std::wstring(v_DisplayPlane.begin(), v_DisplayPlane.end()));
- in->SetViewingGroup(std::wstring(v_ViewingGroup.begin(), v_ViewingGroup.end()));
- in->SetScaleMinimum(std::wstring(v_ScaleMinimum.begin(), v_ScaleMinimum.end()));
+ in->SetDrawingPriority(LUA_GetPriority(stateCommands.v_DrawingPriority));
+ in->SetDisplayPlane(std::wstring(stateCommands.v_DisplayPlane.begin(), stateCommands.v_DisplayPlane.end()));
+ in->SetViewingGroup(stateCommands.v_ViewingGroup);
+ in->SetScaleMinimum(std::wstring(stateCommands.v_ScaleMinimum.begin(), stateCommands.v_ScaleMinimum.end()));
if (false == lineStyle.IsEmpty())
{
in->SetLineStyle(new S100_LineStyle(lineStyle));
}
- if (v_ArcByRadius.size() > 0)
+ if (stateCommands.v_ArcByRadius.size() > 0)
{
- std::vector v_splited = Split(v_ArcByRadius, ",");
+ std::vector v_splited = Split(stateCommands.v_ArcByRadius, ",");
if (v_splited.size() == 5)
{
@@ -737,10 +1080,10 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
pcm->displayList->SetDisplayInstruction((S100_Instruction*)in);
in->SetFeatureReference(std::wstring(featureID.begin(), featureID.end()));
- in->SetDrawingPriority(LUA_GetPriority(v_DrawingPriority));
- in->SetDisplayPlane(std::wstring(v_DisplayPlane.begin(), v_DisplayPlane.end()));
- in->SetViewingGroup(std::wstring(v_ViewingGroup.begin(), v_ViewingGroup.end()));
- in->SetScaleMinimum(std::wstring(v_ScaleMinimum.begin(), v_ScaleMinimum.end()));
+ in->SetDrawingPriority(LUA_GetPriority(stateCommands.v_DrawingPriority));
+ in->SetDisplayPlane(std::wstring(stateCommands.v_DisplayPlane.begin(), stateCommands.v_DisplayPlane.end()));
+ in->SetViewingGroup(stateCommands.v_ViewingGroup);
+ in->SetScaleMinimum(std::wstring(stateCommands.v_ScaleMinimum.begin(), stateCommands.v_ScaleMinimum.end()));
if (v_LineInstruction.size() > 0)
{
@@ -762,9 +1105,10 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
{
S100_SpatialReference* sref = new S100_SpatialReference();
in->SetSpatialReference(sref);
- std::string v_SpatialReference = *it;
+ std::string_view v_SpatialReference = *it;
- std::vector v_splited = Split(v_SpatialReference, "|");
+ std::vector v_splited;
+ Split(v_SpatialReference, "|", v_splited);
if (v_splited.size() == 2)
{
sref->SetType(v_splited[0]);
@@ -786,17 +1130,17 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
pcm->displayList->SetDisplayInstruction((S100_Instruction*)in);
in->SetFeatureReference(std::wstring(featureID.begin(), featureID.end()));
- in->SetDrawingPriority(LUA_GetPriority(v_DrawingPriority));
- in->SetDisplayPlane(std::wstring(v_DisplayPlane.begin(), v_DisplayPlane.end()));
- in->SetViewingGroup(std::wstring(v_ViewingGroup.begin(), v_ViewingGroup.end()));
- in->SetScaleMinimum(std::wstring(v_ScaleMinimum.begin(), v_ScaleMinimum.end()));
+ in->SetDrawingPriority(LUA_GetPriority(stateCommands.v_DrawingPriority));
+ in->SetDisplayPlane(std::wstring(stateCommands.v_DisplayPlane.begin(), stateCommands.v_DisplayPlane.end()));
+ in->SetViewingGroup(stateCommands.v_ViewingGroup);
+ in->SetScaleMinimum(std::wstring(stateCommands.v_ScaleMinimum.begin(), stateCommands.v_ScaleMinimum.end()));
if (v_PointInstruction.size() > 0)
{
in->SetSymbol(new S100_Symbol());
in->GetSymbol()->SetReference(std::wstring(v_PointInstruction.begin(), v_PointInstruction.end()));
- std::vector r_splited = Split(v_Rotation, ",");
+ std::vector r_splited = Split(stateCommands.v_Rotation, ",");
if (r_splited.size() == 2)
{
in->GetSymbol()->SetRotation(std::stod(r_splited[1]));
@@ -804,9 +1148,9 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
}
}
- if (v_AugmentedPoint.size() > 1)
+ if (stateCommands.v_AugmentedPoint.size() > 1)
{
- std::vector v_splited = Split(v_AugmentedPoint, ",");
+ std::vector v_splited = Split(stateCommands.v_AugmentedPoint, ",");
if (v_splited.size() == 3)
{
if (!in->GetVectorPoint()) in->SetVectorPoint(new S100_VectorPoint());
@@ -826,9 +1170,10 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
{
S100_SpatialReference* sref = new S100_SpatialReference();
in->SetSpatialReference(sref);
- std::string v_SpatialReference = *it;
+ std::string_view v_SpatialReference = *it;
- std::vector v_splited = Split(v_SpatialReference, "|");
+ std::vector v_splited;
+ Split(v_SpatialReference, "|", v_splited);
if (v_splited.size() == 2)
{
sref->SetType(v_splited[0]);
@@ -842,22 +1187,16 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
// "SpatialReference:Curve|107"
else if (tag.compare("SpatialReference") == 0)
{
- std::string v_SpatialReference = value;
+ std::string_view v_SpatialReference = value;
vl_SpatialReference.push_back(v_SpatialReference);
}
- else
- {
- CString str;
- str.Format(_T("Lua Parser error - %S(%d)"), tag.c_str(), sizeForIndex);
- //OutputDebugString(str);
- }
}
else if (sizeForIndex == 17)
{
// "TextAlignVertical:Center"
if (tag.compare("TextAlignVertical") == 0)
{
- v_TextAlignVertical = value;
+ stateCommands.v_TextAlignVertical = value;
}
else if (tag.compare("AreaFillReference") == 0)
{
@@ -867,10 +1206,10 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
pcm->displayList->SetDisplayInstruction((S100_Instruction*)in);
in->SetFeatureReference(std::wstring(featureID.begin(), featureID.end()));
- in->SetDrawingPriority(LUA_GetPriority(v_DrawingPriority));
- in->SetDisplayPlane(std::wstring(v_DisplayPlane.begin(), v_DisplayPlane.end()));
- in->SetViewingGroup(std::wstring(v_ViewingGroup.begin(), v_ViewingGroup.end()));
- in->SetScaleMinimum(std::wstring(v_ScaleMinimum.begin(), v_ScaleMinimum.end()));
+ in->SetDrawingPriority(LUA_GetPriority(stateCommands.v_DrawingPriority));
+ in->SetDisplayPlane(std::wstring(stateCommands.v_DisplayPlane.begin(), stateCommands.v_DisplayPlane.end()));
+ in->SetViewingGroup(stateCommands.v_ViewingGroup);
+ in->SetScaleMinimum(std::wstring(stateCommands.v_ScaleMinimum.begin(), stateCommands.v_ScaleMinimum.end()));
if (v_AreaFillReference.size() > 0)
{
@@ -889,19 +1228,13 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
}
v_AreaFillReference = "";
}
- else
- {
- CString str;
- str.Format(_T("Lua Parser error - %S(%d)"), tag.c_str(), sizeForIndex);
- //OutputDebugString(str);
- }
}
else if (sizeForIndex == 19)
{
// "TextAlignHorizontal:End"
if (tag.compare("TextAlignHorizontal") == 0)
{
- v_TextAlignHorizontal = value;
+ stateCommands.v_TextAlignHorizontal = value;
}
else
{
@@ -910,12 +1243,6 @@ bool ProcessS101::LUA_ParsingDrawingInstructions(std::string featureID, std::vec
//OutputDebugString(str);
}
}
- else
- {
- CString str;
- str.Format(_T("Lua Parser error - %S(%d)"), tag.c_str(), sizeForIndex);
- //OutputDebugString(str);
- }
}
}
return true;
@@ -1039,4 +1366,24 @@ std::vector ProcessS101::getParams(PortrayalCatalogue* pc)
}
return params;
+}
+
+bool ProcessS101::IsDrawingCommands(std::string_view str)
+{
+ if (str.compare("PointInstruction") == 0 ||
+ str.compare("LineInstruction") == 0 ||
+ str.compare("LineInstructionUnsuppressed") == 0 ||
+ str.compare("ColorFill") == 0 ||
+ str.compare("AreaFillReference") == 0 ||
+ str.compare("PixmapFill") == 0 ||
+ str.compare("SymbolFill") == 0 ||
+ str.compare("HatchFill") == 0 ||
+ str.compare("TextInstruction") == 0 ||
+ str.compare("CoverageFill") == 0 ||
+ str.compare("NullInstruction") == 0)
+ {
+ return true;
+ }
+
+ return false;
}
\ No newline at end of file
diff --git a/GISLibrary/ProcessS101.h b/GISLibrary/ProcessS101.h
index 98b51f78..92ee2c10 100644
--- a/GISLibrary/ProcessS101.h
+++ b/GISLibrary/ProcessS101.h
@@ -1,6 +1,7 @@
#pragma once
#include "S101LuaScriptingReference.h"
+#include "VisibilityCommands.h"
#include
#include
@@ -8,6 +9,88 @@
class S100Layer;
class PCOutputSchemaManager;
+class Local_StateCommands
+{
+public:
+ Local_StateCommands() = default;
+ virtual ~Local_StateCommands() = default;
+
+public:
+ // Visibility
+ std::vector v_ViewingGroup;
+ DrawingInstructions::ViewingGroup viewingGroup;
+
+ std::string v_DisplayPlane;
+ std::string v_DrawingPriority;
+ std::string v_ScaleMinimum;
+ std::string v_ScaleMaximum;
+ std::string v_Id;
+ std::string v_Parent;
+ std::string v_Hover;
+
+ // Transform
+ std::string v_LocalOffset;
+ std::string v_LinePlacement;
+ std::string v_AreaPlacement;
+ std::string v_AreaCRS;
+ std::string v_Rotation;
+ std::string v_ScaleFactor;
+
+ // Line Style
+ std::string v_LineStyle;
+ std::string v_LineSymbol;
+ std::string v_Dash;
+
+ // Text Style
+ std::string v_FontColor;
+ std::string v_FontSize = "10";
+ std::string v_FontProportion;
+ std::string v_FontWeight;
+ std::string v_FontSlant;
+ std::string v_FontSerifs;
+ std::string v_FontUnderline;
+ std::string v_FontStrikethrough;
+ std::string v_FontUpperline;
+ std::string v_FontReference;
+ std::string v_TextAlignHorizontal;
+ std::string v_TextAlignVertical;
+ std::string v_TextVerticalOffset;
+
+ // Colour Override
+ std::string v_OverrideColor;
+ std::string v_OverrideAll;
+
+ // Geometry
+ std::string v_SpatialReference;
+ std::string v_AugmentedPoint;
+ std::string v_AugmentedRay;
+ std::string v_AugmentedPath;
+ std::string v_Polyline;
+ std::string v_Arc3Points;
+ std::string v_ArcByRadius;
+ std::string v_Annulus;
+ std::string v_ClearAugmented;
+
+ // Coverage
+ std::string v_LookupEntry;
+ std::string v_NumericAnnotation;
+ std::string v_SymbolAnnotation;
+ std::string v_CoverageColor;
+
+ // Time
+ std::string Date;
+ std::string Time;
+ std::string DateTime;
+ std::string TimeValid;
+ std::string ClearTime;
+
+ // Alert
+ std::string v_AlertReference;
+
+public:
+ void Init();
+};
+
class ProcessS101
{
public:
@@ -23,7 +106,8 @@ class ProcessS101
static int ProcessS100_XSLT(std::string inputXmlPath, std::string mainRulePath, std::string outputXmlPath, PortrayalCatalogue* pc = nullptr);
static std::string ProcessS100_XSLT(std::string inputXmlContent, std::string mainRulePath, PortrayalCatalogue* pc = nullptr);
- static bool LUA_ParsingDrawingInstructions(std::string featureID, std::vector elements, PCOutputSchemaManager* pcm);
+ //static bool LUA_ParsingDrawingInstructions(std::string featureID, std::vector elements, PCOutputSchemaManager* pcm);
+ static bool LUA_ParsingDrawingInstructions(std::string_view featureID, std::string_view drawingCommands, PCOutputSchemaManager* pcm);
static std::wstring LUA_GetPriority(std::string lua_priority);
static void InitPortrayal(
@@ -44,4 +128,7 @@ class ProcessS101
// Load params
static std::vector getParams(PortrayalCatalogue * pc);
+
+private:
+ static bool IsDrawingCommands(std::string_view str);
};
\ No newline at end of file
diff --git a/GISLibrary/S100Factory.cpp b/GISLibrary/S100Factory.cpp
new file mode 100644
index 00000000..4ff05e4f
--- /dev/null
+++ b/GISLibrary/S100Factory.cpp
@@ -0,0 +1,2 @@
+#include "stdafx.h"
+#include "S100Factory.h"
diff --git a/GISLibrary/S100Factory.h b/GISLibrary/S100Factory.h
new file mode 100644
index 00000000..53710bd6
--- /dev/null
+++ b/GISLibrary/S100Factory.h
@@ -0,0 +1,8 @@
+#pragma once
+class S100Factory
+{
+public:
+ S100Factory();
+
+};
+
diff --git a/GISLibrary/S100Layer.cpp b/GISLibrary/S100Layer.cpp
index a262231a..aed63000 100644
--- a/GISLibrary/S100Layer.cpp
+++ b/GISLibrary/S100Layer.cpp
@@ -61,8 +61,8 @@ bool S100Layer::Open(CString _filepath, D2D1Resources* d2d1, LayerManager* lm)
if (enc->OpenMetadata(_filepath))
{
auto version = enc->GetVersion();
- fc = lm->catalogManager->getFC(GetProductNumber(), version);
- pc = lm->catalogManager->getPC(GetProductNumber(), version);
+ fc = lm->catalogManager->getFC(GetProductNumber());
+ pc = lm->catalogManager->getPC(GetProductNumber());
SetFeatureCatalog(fc);
SetPC(pc);
}
diff --git a/GISLibrary/S100SpatialObject.cpp b/GISLibrary/S100SpatialObject.cpp
index 4a028d5a..980336da 100644
--- a/GISLibrary/S100SpatialObject.cpp
+++ b/GISLibrary/S100SpatialObject.cpp
@@ -3,6 +3,11 @@
#include "PCOutputSchemaManager.h"
#include "S100Layer.h"
+S100SpatialObject::S100SpatialObject() : SpatialObject()
+{
+ m_ObejctType = SpatialObjectType::S100SpatialObject;
+}
+
S100SpatialObject::S100SpatialObject(D2D1Resources* d2d1) : SpatialObject(d2d1)
{
m_ObejctType = SpatialObjectType::S100SpatialObject;
diff --git a/GISLibrary/S100SpatialObject.h b/GISLibrary/S100SpatialObject.h
index d160869a..b2cb2a42 100644
--- a/GISLibrary/S100SpatialObject.h
+++ b/GISLibrary/S100SpatialObject.h
@@ -19,6 +19,7 @@ class S100Layer;
class S100SpatialObject : public SpatialObject
{
public:
+ S100SpatialObject();
S100SpatialObject(D2D1Resources* d2d1);
virtual ~S100SpatialObject();
diff --git a/GISLibrary/S101Cell.cpp b/GISLibrary/S101Cell.cpp
index c02fc20a..03c549c9 100644
--- a/GISLibrary/S101Cell.cpp
+++ b/GISLibrary/S101Cell.cpp
@@ -507,7 +507,7 @@ bool S101Cell::OpenBy000(CString path)
if (false == ATTRtoAttribute())
{
- return false;
+ //return false;
}
SetAllCode();
@@ -620,7 +620,7 @@ bool S101Cell::OpenMetadataByGML(CString path)
return true;
}
-BOOL S101Cell::ReadDDR(BYTE*& buf)
+bool S101Cell::ReadDDR(BYTE*& buf)
{
int size = atoi(buf, 5);
buf -= 5;
@@ -650,7 +650,7 @@ void S101Cell::SortByFeatureType()
}
}
-BOOL S101Cell::MakeFullSpatialData()
+bool S101Cell::MakeFullSpatialData()
{
POSITION spasPos = NULL;
R_FeatureRecord* fr = nullptr;
@@ -690,7 +690,7 @@ BOOL S101Cell::MakeFullSpatialData()
return TRUE;
}
-BOOL S101Cell::MakePointData(R_FeatureRecord* fe)
+bool S101Cell::MakePointData(R_FeatureRecord* fe)
{
if (fe->geometry)
{
@@ -725,7 +725,7 @@ BOOL S101Cell::MakePointData(R_FeatureRecord* fe)
return TRUE;
}
-BOOL S101Cell::MakeSoundingData(R_FeatureRecord* fe)
+bool S101Cell::MakeSoundingData(R_FeatureRecord* fe)
{
R_MultiPointRecord* r;
__int64 iKey;
@@ -758,7 +758,7 @@ BOOL S101Cell::MakeSoundingData(R_FeatureRecord* fe)
return TRUE;
}
-BOOL S101Cell::MakeLineData(R_FeatureRecord* fe)
+bool S101Cell::MakeLineData(R_FeatureRecord* fe)
{
if (fe->geometry)
{
@@ -810,7 +810,7 @@ BOOL S101Cell::MakeLineData(R_FeatureRecord* fe)
}
// France
-BOOL S101Cell::MakeAreaData(R_FeatureRecord* fe)
+bool S101Cell::MakeAreaData(R_FeatureRecord* fe)
{
if (fe->geometry)
{
@@ -931,7 +931,7 @@ BOOL S101Cell::MakeAreaData(R_FeatureRecord* fe)
return TRUE;
}
-BOOL S101Cell::GetFullSpatialData(R_PointRecord* r, SPoint* point)
+bool S101Cell::GetFullSpatialData(R_PointRecord* r, SPoint* point)
{
double x = 0; r->m_c2it->m_xcoo;
double y = 0; r->m_c2it->m_ycoo;
@@ -977,7 +977,7 @@ BOOL S101Cell::GetFullSpatialData(R_PointRecord* r, SPoint* point)
return TRUE;
}
-BOOL S101Cell::GetFullSpatialData(R_MultiPointRecord* r, SMultiPoint* multiPoint)
+bool S101Cell::GetFullSpatialData(R_MultiPointRecord* r, SMultiPoint* multiPoint)
{
if (r->m_c3il.size() == 1)
{
@@ -1020,7 +1020,7 @@ BOOL S101Cell::GetFullSpatialData(R_MultiPointRecord* r, SMultiPoint* multiPoint
return FALSE;
}
-BOOL S101Cell::GetFullSpatialData(R_CurveRecord* r, std::vector& geoArr, int ORNT)
+bool S101Cell::GetFullSpatialData(R_CurveRecord* r, std::vector& geoArr, int ORNT)
{
if (nullptr != r->m_ptas)
{
@@ -1111,7 +1111,7 @@ BOOL S101Cell::GetFullSpatialData(R_CurveRecord* r, std::vector& geoArr,
return FALSE;
}
-BOOL S101Cell::GetFullSpatialData(R_CurveRecord* r, SCurve* curve, int ORNT)
+bool S101Cell::GetFullSpatialData(R_CurveRecord* r, SCurve* curve, int ORNT)
{
int pointCount = r->GetPointCount();
if (pointCount == 0)
@@ -1235,7 +1235,7 @@ BOOL S101Cell::GetFullSpatialData(R_CurveRecord* r, SCurve* curve, int ORNT)
return FALSE;
}
-BOOL S101Cell::GetFullSpatialData(R_CompositeRecord* r, SCompositeCurve* curve, int ORNT)
+bool S101Cell::GetFullSpatialData(R_CompositeRecord* r, SCompositeCurve* curve, int ORNT)
{
//if (r->m_cuco.size() != 1)
//{
@@ -1327,7 +1327,7 @@ BOOL S101Cell::GetFullSpatialData(R_CompositeRecord* r, SCompositeCurve* curve,
return TRUE;
}
-BOOL S101Cell::GetFullSpatialData(R_CompositeRecord* r, std::vector& geoArr, int ORNT)
+bool S101Cell::GetFullSpatialData(R_CompositeRecord* r, std::vector& geoArr, int ORNT)
{
for (auto i = r->m_cuco.begin(); i != r->m_cuco.end(); i++)
{
@@ -1362,7 +1362,7 @@ BOOL S101Cell::GetFullSpatialData(R_CompositeRecord* r, std::vector& geoA
return TRUE;
}
-BOOL S101Cell::GetFullMaskData(R_FeatureRecord* fe)
+bool S101Cell::GetFullMaskData(R_FeatureRecord* fe)
{
std::list listCurveLink;
@@ -2231,25 +2231,25 @@ POSITION S101Cell::GetFeatureStartPosition()
void S101Cell::GetNextAssoc(POSITION& index, long long& key, R_FeatureRecord*& value)
{
- if (m_feaMatchingKeys.size() > 0)
+ if (!m_feaMatchingKeys.empty())
{
- while (true)
+ while (index != nullptr) // ¹Ýº¹Àº index À¯È¿ÇÒ ¶§±îÁö¸¸
{
- m_feaMap.GetNextAssoc(index, key, value);
- if (index == nullptr)
- {
- key = -1;
- value = nullptr;
- return;
- }
+ m_feaMap.GetNextAssoc(index, key, value); // ÀÌ È£Ãâ ÀÌÈÄ index º¯°æµÊ
- auto iter = std::find(m_feaMatchingKeys.begin(), m_feaMatchingKeys.end(), key);
- if (iter != m_feaMatchingKeys.end())
+ // ¸ÕÀú °Ë»ç ÈÄ Á¾·á
+ if (std::find(m_feaMatchingKeys.begin(), m_feaMatchingKeys.end(), key) != m_feaMatchingKeys.end())
return;
}
+
+ // index ³¡³µÁö¸¸ Á¶°ÇÀ» ¸¸Á·Çϴ Ű¸¦ ¸ø ãÀ½
+ key = -1;
+ value = nullptr;
}
else
+ {
m_feaMap.GetNextAssoc(index, key, value);
+ }
}
void S101Cell::RemoveFeatureMapKey(long long key)
@@ -5118,6 +5118,110 @@ bool S101Cell::ATTRtoAttribute()
return true;
}
+bool S101Cell::ATTRtoAttribute(R_FeatureRecord* fr)
+{
+ if (fr == nullptr)
+ return false;
+
+ if (false == FeatureAttrToAttribute(fr))
+ {
+ return false;
+ }
+
+ if (false == FeatureFeatureAssociationToGFM(fr))
+ {
+ return false;
+ }
+
+ if (false == FeatureInformationAssociationToGFM(fr))
+ {
+ return false;
+ }
+
+ for (const auto& iter : fr->m_inas)
+ {
+ R_InformationRecord* ir = GetInformationRecord(iter->m_name.GetName());
+ if (ir == nullptr)
+ continue;
+
+ if (false == InformationAssociationToGFM(ir))
+ {
+ return false;
+ }
+
+ if (false == InformationAttrToAttribute(ir))
+ {
+ return false;
+ }
+
+ if (false == InformationAssociationToGFM(ir))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void S101Cell::AddATTRtoAttribute(__int64 key)
+{
+ auto fr = GetFeatureRecord(key);
+ if (fr == nullptr)
+ return;
+
+ if (false == FeatureAttrToAttribute(fr))
+ {
+ return;
+ }
+ if (false == FeatureFeatureAssociationToGFM(fr))
+ {
+ return;
+ }
+ if (false == FeatureInformationAssociationToGFM(fr))
+ {
+ return;
+ }
+ for (const auto& iter : fr->m_inas)
+ {
+ R_InformationRecord* ir = GetInformationRecord(iter->m_name.GetName());
+ if (ir == nullptr)
+ continue;
+ if (false == InformationAssociationToGFM(ir))
+ {
+ return;
+ }
+ if (false == InformationAttrToAttribute(ir))
+ {
+ return;
+ }
+ if (false == InformationAssociationToGFM(ir))
+ {
+ return;
+ }
+ }
+}
+
+void S101Cell::DeleteATTRtoAttribute(__int64 key)
+{
+ auto fr = GetFeatureRecord(key);
+ if (fr == nullptr)
+ return;
+
+ for (int i = 0; i < fr->attributes.size(); i++)
+ {
+ if (fr->attributes[i])
+ delete fr->attributes[i], fr->attributes[i] = nullptr;
+ }
+ fr->attributes.clear();
+
+}
+
+void S101Cell::UpdateATTRtoAttribute(__int64 key)
+{
+ DeleteATTRtoAttribute(key);
+ AddATTRtoAttribute(key);
+}
+
bool S101Cell::FeatureAttrToAttribute()
{
auto fc = GetFC();
@@ -5180,6 +5284,63 @@ bool S101Cell::FeatureAttrToAttribute()
return true;
}
+bool S101Cell::FeatureAttrToAttribute(R_FeatureRecord* fr)
+{
+ auto fc = GetFC();
+ std::vector addedAttributes;
+
+ auto ATTRs = fr->GetAllAttributes();
+ for (auto j = ATTRs.begin(); j != ATTRs.end(); j++) {
+ auto ATTR = (*j);
+ auto strCode = m_dsgir.GetAttributeCode(ATTR->m_natc);
+ auto code = pugi::as_utf8(strCode);
+ auto sa = fc->GetSimpleAttribute(std::wstring(strCode));
+ if (sa)
+ {
+ auto value = ATTR->getValueAsString();
+ CString strValue;
+
+ strValue = LibMFCUtil::StringToWString(value).c_str();
+
+ if (ATTR->m_paix > 0)
+ {
+ auto parentCA = (GF::ComplexAttributeType*)addedAttributes.at(ATTR->m_paix - 1);
+ auto addedSA = parentCA->AddSubSimpleAttribute(sa->GetValueType(), code, pugi::as_utf8(std::wstring(strValue)));
+ addedAttributes.push_back((GF::ThematicAttributeType*)addedSA);
+ }
+ else // top level
+ {
+ auto addedSA = fr->AddSimpleAttribute(sa->GetValueType(), code, pugi::as_utf8(std::wstring(strValue)));
+ addedAttributes.push_back(addedSA);
+ }
+ }
+ else
+ {
+ auto ca = fc->GetComplexAttribute(std::wstring(strCode));
+ if (ca)
+ {
+ if (ATTR->m_paix > 0)
+ {
+ auto parentCA = (GF::ComplexAttributeType*)addedAttributes.at(ATTR->m_paix - 1);
+ auto addedCA = parentCA->AddComplexAttribute(code);
+ addedAttributes.push_back(addedCA);
+ }
+ else // top level
+ {
+ auto addedCA = fr->AddComplexAttribute(code);
+ addedAttributes.push_back(addedCA);
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
bool S101Cell::InformationAttrToAttribute()
{
auto fc = GetFC();
@@ -5236,6 +5397,58 @@ bool S101Cell::InformationAttrToAttribute()
return true;
}
+bool S101Cell::InformationAttrToAttribute(R_InformationRecord* ir)
+{
+ auto fc = GetFC();
+ std::vector addedAttributes;
+ auto ATTRs = ir->GetAllAttributes();
+ for (auto j = ATTRs.begin(); j != ATTRs.end(); j++) {
+ auto ATTR = (*j);
+ auto strCode = m_dsgir.GetAttributeCode(ATTR->m_natc);
+ auto code = pugi::as_utf8(strCode);
+ auto sa = fc->GetSimpleAttribute(std::wstring(strCode));
+ if (sa)
+ {
+ auto value = ATTR->getValueAsString();
+ CString strValue;
+
+ strValue = LibMFCUtil::StringToWString(value).c_str();
+
+ if (ATTR->m_paix > 0)
+ {
+ auto parentCA = (GF::ComplexAttributeType*)addedAttributes.at(ATTR->m_paix - 1);
+ auto addedSA = parentCA->AddSubSimpleAttribute(sa->GetValueType(), code, pugi::as_utf8(std::wstring(strValue)));
+ addedAttributes.push_back((GF::ThematicAttributeType*)addedSA);
+ }
+ else // top level
+ {
+ auto addedSA = ir->AddSimpleAttribute(sa->GetValueType(), code, pugi::as_utf8(std::wstring(strValue)));
+ addedAttributes.push_back(addedSA);
+ }
+ }
+ else
+ {
+ auto ca = fc->GetComplexAttribute(std::wstring(strCode));
+ if (ca)
+ {
+ auto addedCA = ir->AddComplexAttribute(code);
+ addedAttributes.push_back(addedCA);
+ if (ATTR->m_paix > 0)
+ {
+ auto parentCA = (GF::ComplexAttributeType*)addedAttributes.at(ATTR->m_paix - 1);
+ parentCA->AddSubAttribute(addedCA->clone());
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
bool S101Cell::FeatureFeatureAssociationToGFM()
{
auto fc = GetFC();
@@ -5259,6 +5472,24 @@ bool S101Cell::FeatureFeatureAssociationToGFM()
return true;
}
+bool S101Cell::FeatureFeatureAssociationToGFM(R_FeatureRecord* fr)
+{
+ auto fc = GetFC();
+ auto fascs = fr->GetAllFeatureAssociations();
+
+ for (auto j = fascs.begin(); j != fascs.end(); j++)
+ {
+ auto fasc = (*j);
+ auto code = m_dsgir.GetFeatureAssociationCodeAsString(fasc->m_nfac);
+ auto role = m_dsgir.GetAssociationRoleCodeAsString(fasc->m_narc);
+ auto rcid = fasc->m_name.GetRCIDasString();
+
+ fr->AddFeatureAssociation(code, role, rcid);
+ }
+
+ return true;
+}
+
bool S101Cell::FeatureInformationAssociationToGFM()
{
auto fc = GetFC();
@@ -5282,6 +5513,24 @@ bool S101Cell::FeatureInformationAssociationToGFM()
return true;
}
+bool S101Cell::FeatureInformationAssociationToGFM(R_FeatureRecord* fr)
+{
+ auto fc = GetFC();
+ auto inass = fr->GetAllInformationAssociations();
+
+ for (auto j = inass.begin(); j != inass.end(); j++)
+ {
+ auto inas = (*j);
+ auto code = m_dsgir.GetInformationAssociationCodeAsString(inas->m_niac);
+ auto role = m_dsgir.GetAssociationRoleCodeAsString(inas->m_narc);
+ auto rcid = inas->m_name.GetRCIDasString();
+
+ fr->AddInformationAssociation(code, role, rcid);
+ }
+
+ return true;
+}
+
bool S101Cell::InformationAssociationToGFM()
{
auto fc = GetFC();
@@ -5305,6 +5554,24 @@ bool S101Cell::InformationAssociationToGFM()
return true;
}
+bool S101Cell::InformationAssociationToGFM(R_InformationRecord* ir)
+{
+ auto fc = GetFC();
+ auto inass = ir->GetAllInformationAssociations();
+
+ for (auto j = inass.begin(); j != inass.end(); j++)
+ {
+ auto inas = (*j);
+ auto code = m_dsgir.GetInformationAssociationCodeAsString(inas->m_niac);
+ auto role = m_dsgir.GetAssociationRoleCodeAsString(inas->m_narc);
+ auto rcid = inas->m_name.GetRCIDasString();
+
+ ir->AddInformationAssociation(code, role, rcid);
+ }
+
+ return true;
+}
+
Version S101Cell::GetVersion() const
{
Version version;
diff --git a/GISLibrary/S101Cell.h b/GISLibrary/S101Cell.h
index edd8a007..a48d5178 100644
--- a/GISLibrary/S101Cell.h
+++ b/GISLibrary/S101Cell.h
@@ -20,7 +20,7 @@ class FeatureCatalogue;
class GeoPoint;
class GeoPointZ;
class Catalog;
-class PCOutputSchemaManager;
+class PCOutputSchemaManager;
class SPoint;
class SCurve;
class SSurface;
@@ -96,7 +96,7 @@ class S101Cell : public S100SpatialObject
R_DSGIR* GetDatasetGeneralInformationRecord();
void UpdateRemoveAll(void);
void RemoveAll(void);
- void ClearAll(void);
+ void ClearAll(void);
bool Open(CString _filepath) override;
bool OpenMetadata(CString _filepath) override;
@@ -109,7 +109,7 @@ class S101Cell : public S100SpatialObject
bool Read8211(std::wstring path);
bool isUpdate();
-
+
bool ConvertFromS101GML(S10XGML* gml);
bool ConvertFromS101GML(S101Creator* creator, R_FeatureRecord* featureRecord, GF::FeatureType* featureType);
bool ConvertFromS101GML(S101Creator* creator, R_FeatureRecord* featureRecord, GF::SimpleAttributeType* simpleAttribute);
@@ -143,37 +143,37 @@ class S101Cell : public S100SpatialObject
bool HasOrientableCurve(pugi::xml_node& root, std::string id);
void AddOrientableCurve(pugi::xml_node& root, pugi::xml_node& prevNode, std::string odID, std::string refID);
- BOOL ReadDDR(BYTE*& buf);
+ bool ReadDDR(BYTE*& buf);
void SortByFeatureType();
- BOOL MakeFullSpatialData();
- BOOL MakePointData(R_FeatureRecord* fe);
- BOOL MakeSoundingData(R_FeatureRecord* fe);
- BOOL MakeLineData(R_FeatureRecord* fe);
- BOOL MakeAreaData(R_FeatureRecord* fe);
+ bool MakeFullSpatialData();
+ bool MakePointData(R_FeatureRecord* fe);
+ bool MakeSoundingData(R_FeatureRecord* fe);
+ bool MakeLineData(R_FeatureRecord* fe);
+ bool MakeAreaData(R_FeatureRecord* fe);
// Record -> Geometry
- BOOL GetFullSpatialData(R_PointRecord *r, SPoint* point); //
- BOOL GetFullSpatialData(R_MultiPointRecord* r, SMultiPoint* multiPoint); //
- BOOL GetFullSpatialData(R_CurveRecord *r, std::vector &geoArr, int ORNT = 1); //
- BOOL GetFullSpatialData(R_CurveRecord* r, SCurve* curve, int ORNT = 1); //
- BOOL GetFullSpatialData(R_CompositeRecord* r, SCompositeCurve* curve, int ORNT = 1); //
- BOOL GetFullSpatialData(R_CompositeRecord *r, std::vector &geoArr, int ORNT = 1); //
+ bool GetFullSpatialData(R_PointRecord* r, SPoint* point); //
+ bool GetFullSpatialData(R_MultiPointRecord* r, SMultiPoint* multiPoint); //
+ bool GetFullSpatialData(R_CurveRecord* r, std::vector& geoArr, int ORNT = 1); //
+ bool GetFullSpatialData(R_CurveRecord* r, SCurve* curve, int ORNT = 1); //
+ bool GetFullSpatialData(R_CompositeRecord* r, SCompositeCurve* curve, int ORNT = 1); //
+ bool GetFullSpatialData(R_CompositeRecord* r, std::vector& geoArr, int ORNT = 1); //
- BOOL GetFullMaskData(R_FeatureRecord* fe);
+ bool GetFullMaskData(R_FeatureRecord* fe);
void Draw(D2D1Resources* D2, Scaler* scaler);
- void Draw(HDC &hDC, Scaler *scaler, double offset = 0);
+ void Draw(HDC& hDC, Scaler* scaler, double offset = 0);
/*
- * set instruction type
+ * set instruction type
* 1 : Point
* 2 : Curve
- * 3 : Surface
+ * 3 : Surface
* 4 : Text
* 5 : Multi Point (Sounding)
*/
- void Draw(HDC &hDC, Scaler *scaler, int priority, int instructionType, double offset = 0);
+ void Draw(HDC& hDC, Scaler* scaler, int priority, int instructionType, double offset = 0);
MBR CalcMBR();
MBR ReMBR();
@@ -193,7 +193,7 @@ class S101Cell : public S100SpatialObject
void SetProductEdition(CString value);
CString GetProductEdition();
std::string GetProductEditionToString();
-
+
void SetApplictionProfile(CString value);
CString GetApplicationProfile();
std::string GetApplicationProfileToString();
@@ -271,7 +271,7 @@ class S101Cell : public S100SpatialObject
R_CurveRecord* GetCurveRecord(__int64 key);
R_CurveRecord* GetCurveRecordByIndex(int index);
POSITION GetCurStartPosition();
- void GetNextAssoc(POSITION& index, long long& key,R_CurveRecord*& value);
+ void GetNextAssoc(POSITION& index, long long& key, R_CurveRecord*& value);
void RemoveAllCurRecord();
//veccurve
std::vector& GetVecCurve();
@@ -305,7 +305,7 @@ class S101Cell : public S100SpatialObject
R_FeatureRecord* GetFeatureRecord(std::wstring wstringKey);
R_FeatureRecord* GetFeatureRecordByIndex(int index);
POSITION GetFeatureStartPosition();
- void GetNextAssoc(POSITION& index,long long& key,R_FeatureRecord*& value);
+ void GetNextAssoc(POSITION& index, long long& key, R_FeatureRecord*& value);
void RemoveFeatureMapKey(long long key);
void RemoveAllFeatureRecord();
std::vector& GetVecFeature();
@@ -351,7 +351,7 @@ class S101Cell : public S100SpatialObject
// Function for adding S-101 update function.
bool UpdateInfMapRecord(S101Cell* cell);
- bool UpdateAttrRecord(std::list Update, std::list Base) ; // To increase utilization, change parameters.
+ bool UpdateAttrRecord(std::list Update, std::list Base); // To increase utilization, change parameters.
bool UpdateINASRecord(std::list Update, std::list Base);
bool UpdateC2ILRecord(std::list update, std::list base, F_COCC* updatemission);
@@ -436,13 +436,22 @@ class S101Cell : public S100SpatialObject
void WritePointRecord(pugi::xml_node& node, R_PointRecord* record);
bool ATTRtoAttribute();
+ bool ATTRtoAttribute(R_FeatureRecord* fr);
+ void AddATTRtoAttribute(__int64 key);
+ void DeleteATTRtoAttribute(__int64 key);
+ void UpdateATTRtoAttribute(__int64 key);
Version GetVersion() const;
private:
bool FeatureAttrToAttribute();
+ bool FeatureAttrToAttribute(R_FeatureRecord* fr);
bool InformationAttrToAttribute();
+ bool InformationAttrToAttribute(R_InformationRecord* ir);
bool FeatureFeatureAssociationToGFM();
+ bool FeatureFeatureAssociationToGFM(R_FeatureRecord* fr);
bool FeatureInformationAssociationToGFM();
+ bool FeatureInformationAssociationToGFM(R_FeatureRecord* fr);
bool InformationAssociationToGFM();
+ bool InformationAssociationToGFM(R_InformationRecord* ir);
};
\ No newline at end of file
diff --git a/GISLibrary/S10XGML.cpp b/GISLibrary/S10XGML.cpp
index 0138408c..2670e32c 100644
--- a/GISLibrary/S10XGML.cpp
+++ b/GISLibrary/S10XGML.cpp
@@ -14,11 +14,14 @@
#include
+S10XGML::S10XGML() : S100SpatialObject()
+{
+ Init();
+}
+
S10XGML::S10XGML(D2D1Resources* d2d1) : S100SpatialObject(d2d1)
{
- type = S100SpatialObjectType::S10XGML;
- m_FileType = S100_FileType::FILE_S_100_VECTOR;
- m_ObejctType = SpatialObjectType::S10XGML;
+ Init();
}
S10XGML::~S10XGML()
@@ -1427,6 +1430,13 @@ std::string S10XGML::GetInformationAssociationRoleCode(GF::InformationType* info
//
//}
+void S10XGML::Init()
+{
+ type = S100SpatialObjectType::S10XGML;
+ m_FileType = S100_FileType::FILE_S_100_VECTOR;
+ m_ObejctType = SpatialObjectType::S10XGML;
+}
+
std::string S10XGML::DeleteXMLNamespace(std::string value)
{
size_t pos = value.find(':');
diff --git a/GISLibrary/S10XGML.h b/GISLibrary/S10XGML.h
index 71385041..757bda04 100644
--- a/GISLibrary/S10XGML.h
+++ b/GISLibrary/S10XGML.h
@@ -26,6 +26,7 @@ class S10XGML :
public S100SpatialObject
{
public:
+ S10XGML();
S10XGML(D2D1Resources* d2d1);
virtual ~S10XGML();
@@ -132,6 +133,7 @@ class S10XGML :
SSurface* SurfaceToSSurface(GM::Surface* surface);
private:
+ void Init();
std::string DeleteXMLNamespace(std::string value);
std::string getCodeFromMember(std::string nodeName);
SPoint* PointToSPoint(GM::Point* point);
diff --git a/GISLibrary/SENC_PointInstruction.cpp b/GISLibrary/SENC_PointInstruction.cpp
index 6c08492a..9b92f529 100644
--- a/GISLibrary/SENC_PointInstruction.cpp
+++ b/GISLibrary/SENC_PointInstruction.cpp
@@ -542,6 +542,7 @@ void SENC_PointInstruction::GetDrawPoints(Scaler* scaler, std::listRCNM == 120 && geom->GetType() == SGeometryType::CompositeCurve)
{
SCompositeCurve* geo = (SCompositeCurve*)geom;
@@ -561,6 +562,7 @@ void SENC_PointInstruction::GetDrawPoints(Scaler* scaler, std::listRCNM == 120 && geom->GetType() == SGeometryType::Surface)
{
SSurface* geo = (SSurface*)geom;
@@ -589,6 +591,16 @@ void SENC_PointInstruction::GetDrawPoints(Scaler* scaler, std::listGetX();
+ double my = vectorPoint->GetY();
+
+ projection(mx, my);
+ scaler->WorldToDevice_F(mx, my, &tempPoint.x, &tempPoint.y);
+ points.push_back(tempPoint);
+ }
else
{
D2D1_POINT_2F tempPoint;
diff --git a/GISLibrary/SENC_TextInstruction.cpp b/GISLibrary/SENC_TextInstruction.cpp
index c7063259..9b246f04 100644
--- a/GISLibrary/SENC_TextInstruction.cpp
+++ b/GISLibrary/SENC_TextInstruction.cpp
@@ -163,6 +163,11 @@ void SENC_TextInstruction::GetDrawPoints(Scaler *scaler, std::listGetGeometry();
+ if (fr->GetIDAsInteger() == 250)
+ {
+ OutputDebugString(L"A");
+ }
+
if (true == HasSpatialReference())
{
for (auto i = spatialReference.begin(); i != spatialReference.end(); i++)
diff --git a/GISLibrary/SENC_VectorPoint.cpp b/GISLibrary/SENC_VectorPoint.cpp
index f2851ce8..684cfb2d 100644
--- a/GISLibrary/SENC_VectorPoint.cpp
+++ b/GISLibrary/SENC_VectorPoint.cpp
@@ -9,4 +9,24 @@ SENC_VectorPoint::SENC_VectorPoint()
SENC_VectorPoint::~SENC_VectorPoint()
{
+}
+
+double SENC_VectorPoint::GetX()
+{
+ return x;
+}
+
+void SENC_VectorPoint::SetX(double x)
+{
+ this->x = x;
+}
+
+double SENC_VectorPoint::GetY()
+{
+ return y;
+}
+
+void SENC_VectorPoint::SetY(double y)
+{
+ this->y = y;
}
\ No newline at end of file
diff --git a/GISLibrary/SENC_VectorPoint.h b/GISLibrary/SENC_VectorPoint.h
index 37dbfdb6..f2083b52 100644
--- a/GISLibrary/SENC_VectorPoint.h
+++ b/GISLibrary/SENC_VectorPoint.h
@@ -9,4 +9,11 @@ class SENC_VectorPoint
public:
double x = 0;
double y = 0;
+
+public:
+ double GetX();
+ void SetX(double x);
+
+ double GetY();
+ void SetY(double y);
};
\ No newline at end of file
diff --git a/GISLibrary/SpatialObject.cpp b/GISLibrary/SpatialObject.cpp
index bdab3062..c778fd25 100644
--- a/GISLibrary/SpatialObject.cpp
+++ b/GISLibrary/SpatialObject.cpp
@@ -1,6 +1,11 @@
#include "stdafx.h"
#include "SpatialObject.h"
+SpatialObject::SpatialObject()
+{
+
+}
+
SpatialObject::SpatialObject(D2D1Resources* d2d1)
{
this->D2 = d2d1;
diff --git a/GISLibrary/SpatialObject.h b/GISLibrary/SpatialObject.h
index e04b503c..c3bd2ecf 100644
--- a/GISLibrary/SpatialObject.h
+++ b/GISLibrary/SpatialObject.h
@@ -11,6 +11,7 @@ class Scaler;
class SpatialObject
{
public:
+ SpatialObject();
SpatialObject(D2D1Resources* d2d1);
virtual ~SpatialObject();
diff --git a/GISLibrary/StateCommand.h b/GISLibrary/StateCommand.h
index b29cfba9..e3133c20 100644
--- a/GISLibrary/StateCommand.h
+++ b/GISLibrary/StateCommand.h
@@ -1,12 +1,15 @@
#pragma once
+
#include
namespace DrawingInstructions
{
- class StateCommand {
+ class StateCommand
+ {
public:
StateCommand() = default;
virtual ~StateCommand() = default;
+ virtual void init() = 0;
virtual void execute() = 0;
virtual void parse(const std::string& input) = 0;
};
diff --git a/GISLibrary/StateCommands.h b/GISLibrary/StateCommands.h
index 615841e1..d9648ce5 100644
--- a/GISLibrary/StateCommands.h
+++ b/GISLibrary/StateCommands.h
@@ -13,8 +13,6 @@
namespace DrawingInstructions
{
-
-
// StateCommands class
class StateCommands {
public:
diff --git a/GISLibrary/TextStyleCommands.cpp b/GISLibrary/TextStyleCommands.cpp
index 437a5534..023f8a76 100644
--- a/GISLibrary/TextStyleCommands.cpp
+++ b/GISLibrary/TextStyleCommands.cpp
@@ -187,6 +187,12 @@ namespace DrawingInstructions
// FontColor class implementation
FontColor::FontColor(const std::string& token, double transparency) : token(token), transparency(transparency) {}
+ void FontColor::init()
+ {
+ token.clear();
+ transparency = 0.0;
+ }
+
void FontColor::execute() {
}
@@ -198,6 +204,13 @@ namespace DrawingInstructions
: token(token), transparency(transparency)
{
}
+
+ void FontBackgroundColor::init()
+ {
+ token.clear();
+ transparency = 0.0;
+ }
+
void FontBackgroundColor::execute() {
}
@@ -209,6 +222,11 @@ namespace DrawingInstructions
// FontSize class implementation
FontSize::FontSize(double bodySize) : bodySize(bodySize) {}
+ void FontSize::init()
+ {
+ bodySize = 0.0;
+ }
+
void FontSize::execute() {
}
@@ -219,6 +237,11 @@ namespace DrawingInstructions
// FontProportion class implementation
FontProportion::FontProportion(const std::string& proportion) : proportion(proportion) {}
+ void FontProportion::init()
+ {
+ proportion.clear();
+ }
+
void FontProportion::execute() {
}
@@ -229,6 +252,11 @@ namespace DrawingInstructions
// FontWeight class implementation
FontWeight::FontWeight(const std::string& weight) : weight(weight) {}
+ void FontWeight::init()
+ {
+ weight.clear();
+ }
+
void FontWeight::execute() {
}
@@ -239,6 +267,11 @@ namespace DrawingInstructions
// FontSlant class implementation
FontSlant::FontSlant(const std::string& slant) : slant(slant) {}
+ void FontSlant::init()
+ {
+ slant.clear();
+ }
+
void FontSlant::execute() {
}
@@ -249,6 +282,11 @@ namespace DrawingInstructions
// FontSerifs class implementation
FontSerifs::FontSerifs(bool serifs) : serifs(serifs) {}
+ void FontSerifs::init()
+ {
+ serifs = false; // Default value
+ }
+
void FontSerifs::execute() {
}
@@ -259,6 +297,11 @@ namespace DrawingInstructions
// FontUnderline class implementation
FontUnderline::FontUnderline(bool underline) : underline(underline) {}
+ void FontUnderline::init()
+ {
+ underline = false; // Default value
+ }
+
void FontUnderline::execute() {
}
@@ -269,6 +312,11 @@ namespace DrawingInstructions
// FontStrikethrough class implementation
FontStrikethrough::FontStrikethrough(bool strikethrough) : strikethrough(strikethrough) {}
+ void FontStrikethrough::init()
+ {
+ strikethrough = false; // Default value
+ }
+
void FontStrikethrough::execute() {
}
@@ -279,6 +327,11 @@ namespace DrawingInstructions
// TextAlignHorizontal class implementation
TextAlignHorizontal::TextAlignHorizontal(const std::string& horizontalAlignment) : horizontalAlignment(horizontalAlignment) {}
+ void TextAlignHorizontal::init()
+ {
+ horizontalAlignment.clear();
+ }
+
void TextAlignHorizontal::execute() {
}
@@ -289,6 +342,11 @@ namespace DrawingInstructions
// TextAlignVertical class implementation
TextAlignVertical::TextAlignVertical(const std::string& verticalAlignment) : verticalAlignment(verticalAlignment) {}
+ void TextAlignVertical::init()
+ {
+ verticalAlignment.clear();
+ }
+
void TextAlignVertical::execute() {
}
@@ -296,6 +354,10 @@ namespace DrawingInstructions
{
}
+ void FontReference::init()
+ {
+ fontReference.clear();
+ }
void FontReference::execute()
{
@@ -305,6 +367,11 @@ namespace DrawingInstructions
{
}
+ void FontUpperline::init()
+ {
+ strikethrough = false; // Default value
+ }
+
void FontUpperline::execute()
{
}
@@ -313,6 +380,11 @@ namespace DrawingInstructions
{
}
+ void TextVerticalOffset::init()
+ {
+ verticalOffset = 0.0; // Default value
+ }
+
void TextVerticalOffset::execute()
{
}
diff --git a/GISLibrary/TextStyleCommands.h b/GISLibrary/TextStyleCommands.h
index 1ab72364..2dc615df 100644
--- a/GISLibrary/TextStyleCommands.h
+++ b/GISLibrary/TextStyleCommands.h
@@ -5,7 +5,11 @@ namespace DrawingInstructions
{
class FontColor : public StateCommand {
public:
+ FontColor() = default;
FontColor(const std::string& token, double transparency);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -16,7 +20,11 @@ namespace DrawingInstructions
class FontBackgroundColor : public StateCommand {
public:
+ FontBackgroundColor() = default;
FontBackgroundColor(const std::string& token, double transparency);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
private:
@@ -24,9 +32,14 @@ namespace DrawingInstructions
double transparency;
};
- class FontSize : public StateCommand {
+ class FontSize : public StateCommand
+ {
public:
+ FontSize() = default;
FontSize(double bodySize);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -34,9 +47,14 @@ namespace DrawingInstructions
double bodySize;
};
- class FontProportion : public StateCommand {
+ class FontProportion : public StateCommand
+ {
public:
+ FontProportion() = default;
FontProportion(const std::string& proportion);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -44,9 +62,14 @@ namespace DrawingInstructions
std::string proportion;
};
- class FontWeight : public StateCommand {
+ class FontWeight : public StateCommand
+ {
public:
+ FontWeight() = default;
FontWeight(const std::string& weight);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -54,9 +77,14 @@ namespace DrawingInstructions
std::string weight;
};
- class FontSlant : public StateCommand {
+ class FontSlant : public StateCommand
+ {
public:
+ FontSlant() = default;
FontSlant(const std::string& slant);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -64,9 +92,14 @@ namespace DrawingInstructions
std::string slant;
};
- class FontSerifs : public StateCommand {
+ class FontSerifs : public StateCommand
+ {
public:
+ FontSerifs() = default;
FontSerifs(bool serifs);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -74,9 +107,14 @@ namespace DrawingInstructions
bool serifs;
};
- class FontUnderline : public StateCommand {
+ class FontUnderline : public StateCommand
+ {
public:
+ FontUnderline() = default;
FontUnderline(bool underline);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -84,9 +122,14 @@ namespace DrawingInstructions
bool underline;
};
- class FontStrikethrough : public StateCommand {
+ class FontStrikethrough : public StateCommand
+ {
public:
+ FontStrikethrough() = default;
FontStrikethrough(bool strikethrough);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -94,10 +137,15 @@ namespace DrawingInstructions
bool strikethrough;
};
- class FontUpperline : public StateCommand {
+ class FontUpperline : public StateCommand
+ {
public:
+ FontUpperline() = default;
FontUpperline(bool strikethrough)
: strikethrough(strikethrough) {}
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -105,10 +153,15 @@ namespace DrawingInstructions
bool strikethrough;
};
- class FontReference : public StateCommand {
+ class FontReference : public StateCommand
+ {
public:
+ FontReference() = default;
FontReference(const std::string& fontReference)
: fontReference(fontReference) {}
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -116,9 +169,14 @@ namespace DrawingInstructions
std::string fontReference;
};
- class TextAlignHorizontal : public StateCommand {
+ class TextAlignHorizontal : public StateCommand
+ {
public:
+ TextAlignHorizontal() = default;
TextAlignHorizontal(const std::string& horizontalAlignment);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -126,9 +184,14 @@ namespace DrawingInstructions
std::string horizontalAlignment;
};
- class TextAlignVertical : public StateCommand {
+ class TextAlignVertical : public StateCommand
+ {
public:
+ TextAlignVertical() = default;
TextAlignVertical(const std::string& verticalAlignment);
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -136,10 +199,15 @@ namespace DrawingInstructions
std::string verticalAlignment;
};
- class TextVerticalOffset : public StateCommand {
+ class TextVerticalOffset : public StateCommand
+ {
public:
+ TextVerticalOffset() = default;
TextVerticalOffset(double verticalOffset)
: verticalOffset(verticalOffset) {}
+
+ public:
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
diff --git a/GISLibrary/TimeCommands.cpp b/GISLibrary/TimeCommands.cpp
index ca45da2c..1794142c 100644
--- a/GISLibrary/TimeCommands.cpp
+++ b/GISLibrary/TimeCommands.cpp
@@ -80,6 +80,12 @@ namespace DrawingInstructions
Date::Date(const std::string& begin, const std::string& end) : begin(begin), end(end) {}
+ void Date::init()
+ {
+ begin = "";
+ end = "";
+ }
+
void Date::execute() {
}
@@ -89,6 +95,12 @@ namespace DrawingInstructions
Time::Time(const std::string& begin, const std::string& end) : begin(begin), end(end) {}
+ void Time::init()
+ {
+ begin = "";
+ end = "";
+ }
+
void Time::execute()
{
}
@@ -99,6 +111,12 @@ namespace DrawingInstructions
DateTime::DateTime(const std::string& begin, const std::string& end) : begin(begin), end(end) {}
+ void DateTime::init()
+ {
+ begin = "";
+ end = "";
+ }
+
void DateTime::execute()
{
}
@@ -109,6 +127,11 @@ namespace DrawingInstructions
TimeValid::TimeValid(const std::string& closure) : closure(closure) {}
+ void TimeValid::init()
+ {
+ closure = "";
+ }
+
void TimeValid::execute()
{
}
@@ -117,6 +140,10 @@ namespace DrawingInstructions
{
}
+ void ClearTime::init()
+ {
+ }
+
void ClearTime::execute()
{
}
diff --git a/GISLibrary/TimeCommands.h b/GISLibrary/TimeCommands.h
index f9217b83..42f24b9e 100644
--- a/GISLibrary/TimeCommands.h
+++ b/GISLibrary/TimeCommands.h
@@ -4,7 +4,9 @@ namespace DrawingInstructions
{
class Date : public StateCommand {
public:
+ Date() = default;
Date(const std::string& begin, const std::string& end);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -15,7 +17,9 @@ namespace DrawingInstructions
class Time : public StateCommand {
public:
+ Time() = default;
Time(const std::string& begin, const std::string& end);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -26,7 +30,9 @@ namespace DrawingInstructions
class DateTime : public StateCommand {
public:
+ DateTime() = default;
DateTime(const std::string& begin, const std::string& end);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -37,7 +43,9 @@ namespace DrawingInstructions
class TimeValid : public StateCommand {
public:
+ TimeValid() = default;
TimeValid(const std::string& closure);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
@@ -48,6 +56,7 @@ namespace DrawingInstructions
class ClearTime : public StateCommand {
public:
ClearTime();
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
};
diff --git a/GISLibrary/TransformCommands.cpp b/GISLibrary/TransformCommands.cpp
index 4f70d69f..c6e3e3cb 100644
--- a/GISLibrary/TransformCommands.cpp
+++ b/GISLibrary/TransformCommands.cpp
@@ -1,8 +1,6 @@
#include "stdafx.h"
#include "TransformCommands.h"
-
-
-
+#include "..\\LatLonUtility\\LatLonUtility.h"
namespace DrawingInstructions
{
@@ -88,62 +86,177 @@ namespace DrawingInstructions
// LocalOffset class implementation
LocalOffset::LocalOffset(double xOffsetMM, double yOffsetMM) : xOffsetMM(xOffsetMM), yOffsetMM(yOffsetMM) {}
- void LocalOffset::execute() {
+ void LocalOffset::init()
+ {
+ xOffsetMM = 0.0;
+ yOffsetMM = 0.0;
+ }
+
+ void LocalOffset::execute()
+ {
}
void LocalOffset::parse(const std::string& input)
{
+ std::vector parts = LatLonUtility::Split(input, ",");
+ if (parts.size() == 2)
+ {
+ try
+ {
+ xOffsetMM = std::stod(parts[0]);
+ yOffsetMM = std::stod(parts[1]);
+ }
+ catch (const std::exception& e)
+ {
+ init();
+ }
+ }
+ else
+ {
+ init();
+ }
}
// LinePlacement class implementation
LinePlacement::LinePlacement(const std::string& linePlacementMode, double offset, double endOffset, bool visibleParts)
: linePlacementMode(linePlacementMode), offset(offset), endOffset(endOffset), visibleParts(visibleParts) {}
- void LinePlacement::execute() {
+ void LinePlacement::init()
+ {
+ linePlacementMode = "Relative";
+ offset = 0.5;
+ endOffset.reset();
+ visibleParts = false;
+ }
+
+ void LinePlacement::execute()
+ {
}
void LinePlacement::parse(const std::string& input)
{
+ std::vector parts = LatLonUtility::Split(input, ",");
+ if (parts.size() >= 2)
+ {
+ linePlacementMode = parts[0];
+ try
+ {
+ offset = std::stod(parts[1]);
+ if (parts.size() > 2)
+ {
+ endOffset = std::stod(parts[2]);
+ }
+ if (parts.size() > 3)
+ {
+ if (parts[3] == "true")
+ {
+ visibleParts = true;
+ }
+ else if (parts[3] == "false")
+ {
+ visibleParts = false;
+ }
+ }
+ }
+ catch (const std::exception& e)
+ {
+ init();
+ }
+ }
+ else
+ {
+ init();
+ }
}
// AreaPlacement class implementation
AreaPlacement::AreaPlacement(const std::string& areaPlacementMode) : areaPlacementMode(areaPlacementMode) {}
- void AreaPlacement::execute() {
+ void AreaPlacement::init()
+ {
+ areaPlacementMode = "VisibleParts";
+ }
+
+ void AreaPlacement::execute()
+ {
}
void AreaPlacement::parse(const std::string& input)
{
+ areaPlacementMode = input;
}
// AreaCRS class implementation
AreaCRS::AreaCRS(const std::string& areaCRSType) : areaCRSType(areaCRSType) {}
+ void AreaCRS::init()
+ {
+ areaCRSType = "ViGlobalGeometrysibleParts";
+ }
+
void AreaCRS::execute() {
}
void AreaCRS::parse(const std::string& input)
{
+ areaCRSType = input;
}
// Rotation class implementation
Rotation::Rotation(const std::string& rotationCRS, double rotation) : rotationCRS(rotationCRS), rotation(rotation) {}
- void Rotation::execute() {
+ void Rotation::init()
+ {
+ rotationCRS = "PortrayalCRS";
+ rotation = 0.0;
+ }
+
+ void Rotation::execute()
+ {
}
void Rotation::parse(const std::string& input)
{
+ std::vector parts = LatLonUtility::Split(input, ",");
+ if (parts.size() == 2)
+ {
+ rotationCRS = parts[0];
+ try
+ {
+ rotation = std::stod(parts[1]);
+ }
+ catch (const std::exception& e)
+ {
+ init();
+ }
+ }
+ else
+ {
+ init();
+ }
}
// ScaleFactor class implementation
ScaleFactor::ScaleFactor(double scaleFactor) : scaleFactor(scaleFactor) {}
- void ScaleFactor::execute() {
+ void ScaleFactor::init()
+ {
+ scaleFactor = 1.0;
}
- void ScaleFactor::parse(const std::string& input)
+ void ScaleFactor::execute()
{
}
+ void ScaleFactor::parse(const std::string& input)
+ {
+ try
+ {
+ scaleFactor = std::stod(input);
+ }
+ catch (const std::exception& e)
+ {
+ init();
+ }
+ }
}
\ No newline at end of file
diff --git a/GISLibrary/TransformCommands.h b/GISLibrary/TransformCommands.h
index 23bf8736..15dd6252 100644
--- a/GISLibrary/TransformCommands.h
+++ b/GISLibrary/TransformCommands.h
@@ -3,71 +3,87 @@
namespace DrawingInstructions
{
-
-
- class LocalOffset : public StateCommand {
+ class LocalOffset : public StateCommand
+ {
public:
+ LocalOffset() = default;
LocalOffset(double xOffsetMM, double yOffsetMM);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
private:
- double xOffsetMM;
- double yOffsetMM;
+ double xOffsetMM = 0;
+ double yOffsetMM = 0;
};
- class LinePlacement : public StateCommand {
+ class LinePlacement : public StateCommand
+ {
public:
+ LinePlacement() = default;
LinePlacement(const std::string& linePlacementMode, double offset, double endOffset, bool visibleParts);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
private:
- std::string linePlacementMode;
- double offset;
- double endOffset;
- bool visibleParts;
+ std::string linePlacementMode = "Relative"; // or Absolute
+ double offset = 0.5;
+ std::optional endOffset;
+ bool visibleParts = false;
};
- class AreaPlacement : public StateCommand {
+ class AreaPlacement : public StateCommand
+ {
public:
+ AreaPlacement() = default;
AreaPlacement(const std::string& areaPlacementMode);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
private:
- std::string areaPlacementMode;
+ std::string areaPlacementMode = "VisibleParts";
};
- class AreaCRS : public StateCommand {
+ class AreaCRS : public StateCommand
+ {
public:
+ AreaCRS() = default;
AreaCRS(const std::string& areaCRSType);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
private:
- std::string areaCRSType;
+ std::string areaCRSType = "GlobalGeometry";
};
- class Rotation : public StateCommand {
+ class Rotation : public StateCommand
+ {
public:
+ Rotation() = default;
Rotation(const std::string& rotationCRS, double rotation);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
private:
- std::string rotationCRS;
- double rotation;
+ std::string rotationCRS = "PortrayalCRS";
+ double rotation = 0.0;
};
- class ScaleFactor : public StateCommand {
+ class ScaleFactor : public StateCommand
+ {
public:
+ ScaleFactor() = default;
ScaleFactor(double scaleFactor);
+ void init() override;
void execute() override;
void parse(const std::string& input) override;
private:
- double scaleFactor;
+ double scaleFactor = 1.0;
};
diff --git a/GISLibrary/VisibilityCommands.cpp b/GISLibrary/VisibilityCommands.cpp
index 9cf70694..0ac1ecc6 100644
--- a/GISLibrary/VisibilityCommands.cpp
+++ b/GISLibrary/VisibilityCommands.cpp
@@ -1,6 +1,8 @@
#include "stdafx.h"
#include "VisibilityCommands.h"
+#include "..\\LatLonUtility\\LatLonUtility.h"
+
namespace DrawingInstructions
{
VisibilityCommands::~VisibilityCommands() {
@@ -105,73 +107,158 @@ namespace DrawingInstructions
// ViewingGroup class implementation
ViewingGroup::ViewingGroup(const std::vector& viewingGroups) : viewingGroups(viewingGroups) {}
+ void ViewingGroup::init()
+ {
+ viewingGroups.clear();
+ }
+
void ViewingGroup::execute()
{
}
- void ViewingGroup::parse(const std::string& input) {
+ void ViewingGroup::parse(const std::string& input)
+ {
+ viewingGroups = LatLonUtility::Split(input, ",");
}
// DisplayPlane class implementation
DisplayPlane::DisplayPlane(const std::string& displayPlane) : displayPlane(displayPlane) {}
- void DisplayPlane::execute() {
+ void DisplayPlane::init()
+ {
+ displayPlane = "";
+ }
+
+ void DisplayPlane::execute()
+ {
}
- void DisplayPlane::parse(const std::string& input) {
+ void DisplayPlane::parse(const std::string& input)
+ {
+ displayPlane = input;
}
// DrawingPriority class implementation
DrawingPriority::DrawingPriority(int drawingPriority) : drawingPriority(drawingPriority) {}
+ void DrawingPriority::init()
+ {
+ drawingPriority = 0; // Default value
+ }
+
void DrawingPriority::execute() {
}
- void DrawingPriority::parse(const std::string& input) {
+ void DrawingPriority::parse(const std::string& input)
+ {
+ try
+ {
+ drawingPriority = std::stoi(input);
+ }
+ catch (const std::exception& e)
+ {
+ drawingPriority = 0; // Default value if parsing fails
+ }
}
// ScaleMinimum class implementation
ScaleMinimum::ScaleMinimum(int scaleMinimum) : scaleMinimum(scaleMinimum) {}
+ void ScaleMinimum::init()
+ {
+ scaleMinimum = 0;
+ }
+
void ScaleMinimum::execute() {
}
- void ScaleMinimum::parse(const std::string& input) {
+ void ScaleMinimum::parse(const std::string& input)
+ {
+ try
+ {
+ scaleMinimum = std::stoi(input);
+ }
+ catch (const std::exception& e)
+ {
+ scaleMinimum = 0; // Default value if parsing fails
+ }
}
// ScaleMaximum class implementation
ScaleMaximum::ScaleMaximum(int scaleMaximum) : scaleMaximum(scaleMaximum) {}
+ void ScaleMaximum::init()
+ {
+ scaleMaximum = 0;
+ }
+
void ScaleMaximum::execute() {
}
- void ScaleMaximum::parse(const std::string& input) {
+ void ScaleMaximum::parse(const std::string& input)
+ {
+ try
+ {
+ scaleMaximum = std::stoi(input);
+ }
+ catch (const std::exception& e)
+ {
+ scaleMaximum = 0; // Default value if parsing fails
+ }
}
// Id class implementation
Id::Id(const std::string& id) : id(id) {}
+ void Id::init()
+ {
+ id = "";
+ }
+
void Id::execute() {
}
- void Id::parse(const std::string& input) {
+ void Id::parse(const std::string& input)
+ {
+ id = input;
}
// Parent class implementation
Parent::Parent(const std::string& parentId) : parentId(parentId) {}
+ void Parent::init()
+ {
+ parentId = "";
+ }
+
void Parent::execute() {
}
- void Parent::parse(const std::string& input) {
+ void Parent::parse(const std::string& input)
+ {
+ parentId = input;
}
// Hover class implementation
Hover::Hover(bool hover) : hover(hover) {}
+ void Hover::init()
+ {
+ hover = false;
+ }
+
void Hover::execute() {
}
- void Hover::parse(const std::string& input) {
+ void Hover::parse(const std::string& input)
+ {
+ if (input == "true")
+ {
+ hover = true;
+ }
+ else if (input == "false")
+ {
+ hover = false;
+ }
}
}
\ No newline at end of file
diff --git a/GISLibrary/VisibilityCommands.h b/GISLibrary/VisibilityCommands.h
index 0dc17eee..d00b5b72 100644
--- a/GISLibrary/VisibilityCommands.h
+++ b/GISLibrary/VisibilityCommands.h
@@ -3,9 +3,12 @@
namespace DrawingInstructions
{
- class ViewingGroup : public StateCommand {
+ class ViewingGroup : public StateCommand
+ {
public:
+ ViewingGroup() = default;
ViewingGroup(const std::vector& viewingGroups);
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
@@ -13,9 +16,12 @@ namespace DrawingInstructions
std::vector viewingGroups;
};
- class DisplayPlane : public StateCommand {
+ class DisplayPlane : public StateCommand
+ {
public:
+ DisplayPlane() = default;
DisplayPlane(const std::string& displayPlane);
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
@@ -23,39 +29,51 @@ namespace DrawingInstructions
std::string displayPlane;
};
- class DrawingPriority : public StateCommand {
+ class DrawingPriority : public StateCommand
+ {
public:
+ DrawingPriority() = default;
DrawingPriority(int drawingPriority);
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
private:
- int drawingPriority;
+ int drawingPriority = 0;
};
- class ScaleMinimum : public StateCommand {
+ class ScaleMinimum : public StateCommand
+ {
public:
+ ScaleMinimum() = default;
ScaleMinimum(int scaleMinimum);
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
private:
- int scaleMinimum;
+ int scaleMinimum = INT32_MAX;
};
- class ScaleMaximum : public StateCommand {
+ class ScaleMaximum : public StateCommand
+ {
public:
+ ScaleMaximum() = default;
ScaleMaximum(int scaleMaximum);
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
private:
- int scaleMaximum;
+ int scaleMaximum = INT32_MIN;
};
- class Id : public StateCommand {
+ class Id : public StateCommand
+ {
public:
+ Id() = default;
Id(const std::string& id);
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
@@ -63,9 +81,12 @@ namespace DrawingInstructions
std::string id;
};
- class Parent : public StateCommand {
+ class Parent : public StateCommand
+ {
public:
+ Parent() = default;
Parent(const std::string& parentId);
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
@@ -76,16 +97,14 @@ namespace DrawingInstructions
class Hover : public StateCommand {
public:
Hover(bool hover);
+ virtual void init() override;
virtual void execute() override;
virtual void parse(const std::string& input) override;
private:
- bool hover;
+ bool hover = false;
};
-
-
-
class VisibilityCommands
{
public:
@@ -105,7 +124,6 @@ namespace DrawingInstructions
void setParent(const std::string& parentId);
void setHover(bool hover);
-
void parse(const std::string& key, std::string value);
void execute() const;
diff --git a/LatLonUtility/LatLonUtility.cpp b/LatLonUtility/LatLonUtility.cpp
index 6b29288f..924b3f14 100644
--- a/LatLonUtility/LatLonUtility.cpp
+++ b/LatLonUtility/LatLonUtility.cpp
@@ -122,7 +122,9 @@ std::vector LatLonUtility::Split(std::string targetStr, std::string
{
// Check parameters
if (token.length() == 0 || targetStr.find(token) == std::string::npos)
+ {
return std::vector({ targetStr });
+ }
// return var
std::vector ret;
@@ -139,6 +141,28 @@ std::vector LatLonUtility::Split(std::string targetStr, std::string
return ret;
}
+void LatLonUtility::Split(std::string_view targetStr, std::string_view token, std::vector& result)
+{
+ // Check parameters
+ if (token.length() == 0 || targetStr.find(token) == std::string::npos)
+ {
+ result.push_back(targetStr);
+ }
+
+ // return var
+ std::vector ret;
+
+ int findOffset = 0;
+ int splitOffset = 0;
+ while ((splitOffset = (int)targetStr.find(token, findOffset)) != std::string::npos)
+ {
+ result.push_back(targetStr.substr(findOffset, splitOffset - findOffset));
+ findOffset = splitOffset + (int)token.length();
+ }
+
+ result.push_back(targetStr.substr(findOffset, targetStr.length() - findOffset));
+}
+
unsigned char* LatLonUtility::HexStringToWKB(std::string value)
{
if (value.length() <= 0 || value.length() % 2 != 0)
diff --git a/LatLonUtility/LatLonUtility.h b/LatLonUtility/LatLonUtility.h
index 77308484..3e1e581c 100644
--- a/LatLonUtility/LatLonUtility.h
+++ b/LatLonUtility/LatLonUtility.h
@@ -66,6 +66,7 @@ namespace LatLonUtility {
//wchar_t* ConvertCtoWC(char* str);
std::vector Split(std::string targetStr, std::string token);
+ void Split(std::string_view targetStr, std::string_view token, std::vector& result);
// value : 0101000000000000000000F03F000000000000F03F
unsigned char* HexStringToWKB(std::string value);
diff --git a/OpenS100/OpenS100.vcxproj b/OpenS100/OpenS100.vcxproj
index a5ca5a58..36cd7c73 100644
--- a/OpenS100/OpenS100.vcxproj
+++ b/OpenS100/OpenS100.vcxproj
@@ -98,7 +98,7 @@
$(SolutionDir)$(Configuration)_$(Platform)\
- Release
+ Debug
true
diff --git a/PortrayalCatalogue/S100_Dash.cpp b/PortrayalCatalogue/S100_Dash.cpp
index 72ad3b96..4bf747dd 100644
--- a/PortrayalCatalogue/S100_Dash.cpp
+++ b/PortrayalCatalogue/S100_Dash.cpp
@@ -106,4 +106,15 @@ void S100_Dash::ParseValue(std::string value)
start = std::wstring(v_splited[0].begin(), v_splited[0].end());
length = std::wstring(v_splited[1].begin(), v_splited[1].end());
}
+}
+
+void S100_Dash::ParseValue(std::string_view value)
+{
+ std::vector v_splited;
+ LatLonUtility::Split(value, ",", v_splited);
+ if (v_splited.size() >= 2)
+ {
+ start = std::wstring(v_splited[0].begin(), v_splited[0].end());
+ length = std::wstring(v_splited[1].begin(), v_splited[1].end());
+ }
}
\ No newline at end of file
diff --git a/PortrayalCatalogue/S100_Dash.h b/PortrayalCatalogue/S100_Dash.h
index 820ec3aa..9b0cfb27 100644
--- a/PortrayalCatalogue/S100_Dash.h
+++ b/PortrayalCatalogue/S100_Dash.h
@@ -29,4 +29,5 @@ class S100_Dash
void SetEmpty();
void ParseValue(std::string value);
+ void ParseValue(std::string_view value);
};
\ No newline at end of file
diff --git a/PortrayalCatalogue/S100_Instruction.cpp b/PortrayalCatalogue/S100_Instruction.cpp
index 0c66b8b3..a57556d6 100644
--- a/PortrayalCatalogue/S100_Instruction.cpp
+++ b/PortrayalCatalogue/S100_Instruction.cpp
@@ -59,11 +59,32 @@ void S100_Instruction::SetViewingGroup(std::wstring& value)
viewingGroup.push_back(value);
}
+void S100_Instruction::SetViewingGroup(std::vector& value)
+{
+ for (const auto& v : value)
+ {
+ viewingGroup.push_back(std::wstring(v.begin(), v.end()));
+ }
+}
+
+void S100_Instruction::SetViewingGroup(std::vector& value)
+{
+ for (const auto& v : value)
+ {
+ viewingGroup.push_back(std::wstring(v.begin(), v.end()));
+ }
+}
+
void S100_Instruction::SetDisplayPlane(std::wstring& value)
{
displayPlane = value;
}
+void S100_Instruction::SetDisplayPlane(std::string& value)
+{
+ displayPlane = std::wstring(value.begin(), value.end());
+}
+
void S100_Instruction::SetDrawingPriority(std::wstring& value)
{
try
diff --git a/PortrayalCatalogue/S100_Instruction.h b/PortrayalCatalogue/S100_Instruction.h
index 4d585b85..15cdba00 100644
--- a/PortrayalCatalogue/S100_Instruction.h
+++ b/PortrayalCatalogue/S100_Instruction.h
@@ -63,7 +63,10 @@ class S100_Instruction
void SetSpatialReference(S100_SpatialReference* value);
void SetSpatialReference(std::list value);
void SetViewingGroup(std::wstring& value);
+ void SetViewingGroup(std::vector& value);
+ void SetViewingGroup(std::vector& value);
void SetDisplayPlane(std::wstring& value);
+ void SetDisplayPlane(std::string& value);
void SetDrawingPriority(std::wstring& value);
void SetDrawingPriority(int value);
void SetScaleMinimum(std::wstring& value);
diff --git a/PortrayalCatalogue/S100_LineStyle.cpp b/PortrayalCatalogue/S100_LineStyle.cpp
index f099e09d..1d375a17 100644
--- a/PortrayalCatalogue/S100_LineStyle.cpp
+++ b/PortrayalCatalogue/S100_LineStyle.cpp
@@ -108,6 +108,45 @@ void S100_LineStyle::ParseValue(std::string value)
}
}
+void S100_LineStyle::ParseValue(std::string_view value)
+{
+ SetEmpty();
+
+ std::vector v_splited;
+ LatLonUtility::Split(value, ",", v_splited);
+ if (v_splited.size() >= 4)
+ {
+ name = std::wstring(v_splited[0].begin(), v_splited[0].end());
+ intervalLength = std::wstring(v_splited[1].begin(), v_splited[1].end());
+ width = std::wstring(v_splited[2].begin(), v_splited[2].end());
+ token = std::wstring(v_splited[3].begin(), v_splited[3].end());
+
+ if (v_splited.size() >= 5)
+ {
+ transparency = std::wstring(v_splited[4].begin(), v_splited[4].end());
+
+ if (v_splited.size() >= 6)
+ {
+ capStyle = std::wstring(v_splited[5].begin(), v_splited[5].end());
+
+ if (v_splited.size() >= 7)
+ {
+ joinStyle = std::wstring(v_splited[6].begin(), v_splited[6].end());
+
+ if (v_splited.size() >= 8)
+ {
+ offset = std::wstring(v_splited[7].begin(), v_splited[7].end());
+ }
+ }
+ }
+ }
+
+ m_pen.SetWidth(width);
+ m_pen.GetColor().SetToken(token);
+ m_pen.GetColor().SetTransparency(_wtof(transparency.c_str()));
+ }
+}
+
bool S100_LineStyle::IsEmpty()
{
return width.empty();
diff --git a/PortrayalCatalogue/S100_LineStyle.h b/PortrayalCatalogue/S100_LineStyle.h
index a10f8706..99d8c5d4 100644
--- a/PortrayalCatalogue/S100_LineStyle.h
+++ b/PortrayalCatalogue/S100_LineStyle.h
@@ -35,6 +35,7 @@ class S100_LineStyle : public S100_LineStyleBase
void GetContents(pugi::xml_node& node);
void ParseValue(std::string value);
+ void ParseValue(std::string_view value);
bool IsEmpty();
void SetEmpty();
diff --git a/PortrayalCatalogue/S100_SpatialReference.cpp b/PortrayalCatalogue/S100_SpatialReference.cpp
index d9f5b2a1..7cdd5ddd 100644
--- a/PortrayalCatalogue/S100_SpatialReference.cpp
+++ b/PortrayalCatalogue/S100_SpatialReference.cpp
@@ -16,7 +16,17 @@ void S100_SpatialReference::SetType(std::string &value)
type = std::wstring(value.begin(), value.end());
}
-void S100_SpatialReference::SetReference(std::string &value)
+void S100_SpatialReference::SetType(std::string_view value)
+{
+ type = std::wstring(value.begin(), value.end());
+}
+
+void S100_SpatialReference::SetReference(std::string& value)
+{
+ reference = std::wstring(value.begin(), value.end());
+}
+
+void S100_SpatialReference::SetReference(std::string_view value)
{
reference = std::wstring(value.begin(), value.end());
}
diff --git a/PortrayalCatalogue/S100_SpatialReference.h b/PortrayalCatalogue/S100_SpatialReference.h
index 4de706d3..ec5f5bdd 100644
--- a/PortrayalCatalogue/S100_SpatialReference.h
+++ b/PortrayalCatalogue/S100_SpatialReference.h
@@ -20,8 +20,10 @@ class S100_SpatialReference
// boolean
S100::Boolean forward = true;
public:
- void SetType(std::string &value);
- void SetReference(std::string &value);
+ void SetType(std::string& value);
+ void SetType(std::string_view value);
+ void SetReference(std::string& value);
+ void SetReference(std::string_view value);
void SetForward();
void SetBackward();
diff --git a/S100Engine/S100Engine.cpp b/S100Engine/S100Engine.cpp
index fe905915..a315b1da 100644
Binary files a/S100Engine/S100Engine.cpp and b/S100Engine/S100Engine.cpp differ
diff --git a/S100Engine/S100Engine.h b/S100Engine/S100Engine.h
index 2bb60bf9..a39b9382 100644
Binary files a/S100Engine/S100Engine.h and b/S100Engine/S100Engine.h differ
diff --git a/S100Engine/S100PCManager.cpp b/S100Engine/S100PCManager.cpp
index f955159d..788784ac 100644
--- a/S100Engine/S100PCManager.cpp
+++ b/S100Engine/S100PCManager.cpp
@@ -596,6 +596,7 @@ ID2D1BitmapBrush* S100PCManager::CreateBitmapBrush(AreaPatternBitmap* patternBit
pCurrentBitmapBrush->SetExtendModeX(D2D1_EXTEND_MODE_WRAP);
pCurrentBitmapBrush->SetExtendModeY(D2D1_EXTEND_MODE_WRAP);
pCurrentBitmapBrush->SetInterpolationMode(D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
+ SafeRelease(&pCurrentBitmap);
return pCurrentBitmapBrush;
}
diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json
new file mode 100644
index 00000000..667b11d6
--- /dev/null
+++ b/vcpkg-configuration.json
@@ -0,0 +1,9 @@
+{
+ "binarySources": [
+ { "type": "clear" },
+ {
+ "type": "local",
+ "path": "${env:VCPKG_DEFAULT_BINARY_CACHE}"
+ }
+ ]
+}
\ No newline at end of file