Skip to content

Commit

Permalink
Fix propagation of srsOverride into objects
Browse files Browse the repository at this point in the history
  • Loading branch information
shehzan10 committed Nov 30, 2018
1 parent 056923d commit d1f8254
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
5 changes: 4 additions & 1 deletion sources/include/parser/gmlfeaturecollectionparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ namespace citygml {
// GMLObjectElementParser interface
virtual Object* getObject() override;

const Envelope& getEnvelope() const;
bool getSourceSRSOverride() const;

private:
Envelope* m_bounds;
bool m_srsSRSOverride;
bool m_sourceSRSOverride;


};
Expand Down
6 changes: 6 additions & 0 deletions sources/src/parser/citymodelelementparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ namespace citygml {
CITYGML_LOG_WARN(m_logger, "Expected end tag <" << NodeType::CORE_CityModelNode.name() << "> got <" << node.name() << "> at " << getDocumentLocation());
}

if (getSourceSRSOverride()) {
Envelope *envelope = new Envelope(getEnvelope().srsName());
envelope->setLowerBound(m_model->getEnvelope().getLowerBound());
envelope->setUpperBound(m_model->getEnvelope().getUpperBound());
m_model->setEnvelope(envelope);
}
m_callback(m_model);
return true;
}
Expand Down
6 changes: 6 additions & 0 deletions sources/src/parser/cityobjectelementparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ namespace citygml {

bool CityObjectElementParser::parseElementEndTag(const NodeType::XMLNode&, const std::string&)
{
if (getSourceSRSOverride()) {
Envelope *envelope = new Envelope(getEnvelope().srsName());
envelope->setLowerBound(m_model->getEnvelope().getLowerBound());
envelope->setUpperBound(m_model->getEnvelope().getUpperBound());
m_model->setEnvelope(envelope);
}
m_callback(m_model);
m_model = nullptr;
return true;
Expand Down
14 changes: 11 additions & 3 deletions sources/src/parser/gmlfeaturecollectionparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ namespace citygml {
: GMLObjectElementParser(documentParser, factory, logger)
{
m_bounds = nullptr;
m_srsSRSOverride = false;
m_sourceSRSOverride = false;
std::string paramsSrcSRS = documentParser.getParserParams().srcSRS;
if (!paramsSrcSRS.empty()) {
m_bounds = new Envelope(paramsSrcSRS);
m_srsSRSOverride = true;
m_sourceSRSOverride = true;
}
}

Expand All @@ -40,7 +40,7 @@ namespace citygml {
return true;
} else if (node == NodeType::GML_EnvelopeNode) {

if (m_srsSRSOverride) {
if (m_sourceSRSOverride) {
return true;
}
if (m_bounds != nullptr) {
Expand Down Expand Up @@ -93,6 +93,14 @@ namespace citygml {
return getFeatureObject();
}

const Envelope& GMLFeatureCollectionElementParser::getEnvelope() const
{
return *m_bounds;
}

bool GMLFeatureCollectionElementParser::getSourceSRSOverride() const
{
return m_sourceSRSOverride;
}

}

0 comments on commit d1f8254

Please sign in to comment.