use of org.hwyl.sexytopo.model.sketch.Sketch in project sexytopo by richsmith.
the class ConnectedSurveys method updateTranslatedConnectedSurveys.
private static void updateTranslatedConnectedSurveys(GraphActivity activity, Survey original, Map<Survey, Space<Coord2D>> translated, Survey survey, Space<Coord2D> projection) {
Map<Station, Set<SurveyConnection>> connections = survey.getConnectedSurveys();
for (Station connectingStation : connections.keySet()) {
Coord2D connectingStationLocation = projection.getStationMap().get(connectingStation);
for (SurveyConnection connection : connections.get(connectingStation)) {
Station otherConnectingStation = connection.stationInOtherSurvey;
Survey otherSurvey = connection.otherSurvey;
if (haveWeAlreadyDoneThisSurvey(translated, otherSurvey, original)) {
continue;
}
// create a new copy of the survey so we can edit the associated sketch
// (this might seem a bit messy but it's reasonably elegant, honest!)
Survey lightweightSurveyCopy = new Survey(otherSurvey.getName());
lightweightSurveyCopy.setOrigin(otherSurvey.getOrigin());
Space<Coord2D> otherProjection = SpaceFlipper.flipVertically(activity.getProjection(connection.otherSurvey));
Coord2D otherConnectingStationLocation = otherProjection.getStationMap().get(otherConnectingStation);
Coord2D transformation = connectingStationLocation.minus(otherConnectingStationLocation);
Sketch translatedPlan = otherSurvey.getPlanSketch().getTranslatedCopy(transformation);
lightweightSurveyCopy.setPlanSketch(translatedPlan);
Sketch translatedElevation = otherSurvey.getElevationSketch().getTranslatedCopy(transformation);
lightweightSurveyCopy.setElevationSketch(translatedElevation);
otherProjection = Space2DUtils.transform(otherProjection, transformation);
translated.put(lightweightSurveyCopy, otherProjection);
updateTranslatedConnectedSurveys(activity, original, translated, otherSurvey, otherProjection);
}
}
}
use of org.hwyl.sexytopo.model.sketch.Sketch in project sexytopo by richsmith.
the class PocketTopoTxtImporter method parseSketch.
private static Sketch parseSketch(String text) {
Sketch sketch = new Sketch();
Set<PathDetail> pathDetails = parsePolylines(text);
sketch.setPathDetails(pathDetails);
return sketch;
}
use of org.hwyl.sexytopo.model.sketch.Sketch in project sexytopo by richsmith.
the class PocketTopoTxtImporter method getElevation.
private static Sketch getElevation(String fullText) {
String text = getSection(fullText, "ELEVATION");
Sketch elevation = parseSketch(text);
return elevation;
}
use of org.hwyl.sexytopo.model.sketch.Sketch in project sexytopo by richsmith.
the class PocketTopoTxtImporter method toSurvey.
public Survey toSurvey(File file) {
String text = Loader.slurpFile(file.getAbsolutePath());
// FIXME we're ignoring the metadata for now
Survey survey = new Survey(getDefaultName(file));
parseDataAndUpdateSurvey(survey, text);
Sketch elevation = getElevation(text);
survey.setElevationSketch(elevation);
Sketch plan = getPlan(text);
survey.setPlanSketch(plan);
survey.setSaved(true);
return survey;
}
use of org.hwyl.sexytopo.model.sketch.Sketch in project sexytopo by richsmith.
the class XviImporter method getSketch.
public static Sketch getSketch(File file) throws Exception {
Sketch sketch = new Sketch();
String contents = Loader.slurpFile(file);
Grid grid = instance.parseGrid(contents);
double scale = grid.dy;
Set<PathDetail> pathDetails = parseSketchlineBlock(scale, contents);
sketch.setPathDetails(pathDetails);
return sketch;
}
Aggregations