Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External models #125

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
18 changes: 17 additions & 1 deletion src/org/osm2world/core/world/modules/ExternalModelModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public void defineEleConstraints(EleConstraintEnforcer enforcer) {}
public void renderTo(Target<?> target) {

VectorXYZ position = eleConnector.getPosXYZ();

double direction = parseDirection(element.getTags(), 0);
Double height = (double)parseHeight(element.getTags(), 0);
Double width = (double)parseWidth(element.getTags(), 0);
Expand Down Expand Up @@ -97,13 +98,28 @@ private ExternalModelNodeWorldObject(MapNode node, Model model) {
public Iterable<EleConnector> getEleConnectors() {

if (eleConnector == null) {
VectorXZ pos = element.getPos();
VectorXZ pos = getPosition(element);
eleConnector = new EleConnector(pos, element, GroundState.ON);
}

return singletonList(eleConnector);

}

private VectorXZ getPosition(MapNode element) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tordanik this is the part where I've stucked for now. Usually model 0. 0 point doesn't match mapNode position. So I have to calculate origin transform vector to move it. I need an access to mapProjection, but not sure waht would be the gracefull way to do that. Not sure that it's worth to add a reference on it in mapNode.

if (element.getTags().containsKey("model:lon") &&
element.getTags().containsKey("model:lat")) {
// I need an access to mapProjection here, or at the moment
// of MapNode creation

// Better to have it here because here I have full access to
// model itself nad model metadata
return element.getPos();
}
else {
return element.getPos();
}
}

}

Expand Down