Skip to content

Commit 40edf54

Browse files
author
David Baum
committed
revert unintented merge
1 parent 3d5e29f commit 40edf54

44 files changed

Lines changed: 1395 additions & 1155 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

generator2/org.getaviz.generator/pom.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,37 @@
155155
<configuration>
156156
<skip>false</skip>
157157
<quiet>true</quiet>
158+
<!--<dependencyDetailsEnabled>false</dependencyDetailsEnabled>
159+
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>-->
158160
</configuration>
159161
</plugin>
162+
<!-- <plugin> -->
163+
<!-- <groupId>org.codehaus.mojo</groupId> -->
164+
<!-- <artifactId>exec-maven-plugin</artifactId> -->
165+
<!-- <version>1.4.0</version> -->
166+
<!-- <executions> -->
167+
<!-- <execution> -->
168+
<!-- <phase>deploy</phase> -->
169+
<!-- <goals> -->
170+
<!-- <goal>java</goal> -->
171+
<!-- </goals> -->
172+
<!-- </execution> -->
173+
<!-- </executions> -->
174+
<!-- <configuration> -->
175+
<!-- <executable>java</executable> -->
176+
<!-- <includeProjectDependencies>true</includeProjectDependencies> -->
177+
<!-- <includePluginDependencies>true</includePluginDependencies> -->
178+
<!-- <arguments> -->
179+
<!-- uncomment to increase java heap size -->
180+
<!-- <argument>-Xmx8g</argument> -->
181+
<!-- <argument>-classpath</argument> -->
182+
<!-- <classpath /> -->
183+
<!-- <argument>org.getaviz.generator.Generator</argument> -->
184+
<!-- <argument>-p</argument> -->
185+
<!-- <argument>runtimeProject=${project.basedir}</argument> -->
186+
<!-- </arguments> -->
187+
<!-- </configuration> -->
188+
<!-- </plugin> -->
160189
<plugin>
161190
<groupId>org.apache.maven.plugins</groupId>
162191
<artifactId>maven-war-plugin</artifactId>

generator2/org.getaviz.generator/src/main/java/org/getaviz/generator/ColorGradient.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

generator2/org.getaviz.generator/src/main/java/org/getaviz/generator/Generator.java

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,64 @@
22

33
import org.apache.commons.logging.Log;
44
import org.apache.commons.logging.LogFactory;
5+
import org.getaviz.generator.city.m2m.City2City;
6+
import org.getaviz.generator.city.m2t.City2AFrame;
7+
import org.getaviz.generator.city.m2t.City2X3D;
8+
import org.getaviz.generator.jqa.DatabaseBuilder;
9+
import org.getaviz.generator.jqa.JQA2JSON;
10+
import org.getaviz.generator.rd.m2m.RD2RD;
11+
import org.getaviz.generator.rd.m2t.RD2AFrame;
12+
import org.getaviz.generator.rd.m2t.RD2X3D;
13+
import org.getaviz.generator.city.s2m.JQA2City;
14+
import org.getaviz.generator.rd.s2m.JQA2RD;
515

6-
class Generator {
7-
private Log log = LogFactory.getLog(this.getClass());
8-
private Metaphor metaphor;
16+
public class Generator {
17+
private static SettingsConfiguration config = SettingsConfiguration.getInstance();
18+
private static Log log = LogFactory.getLog(Generator.class);
919

10-
Generator(SettingsConfiguration config) {
11-
metaphor = MetaphorFactory.createMetaphor(config);
20+
public static void main(String[] args) {
21+
run();
1222
}
1323

14-
void run() {
24+
public static void run() {
1525
log.info("Generator started");
16-
metaphor.generate();
17-
log.info("Generator finished");
26+
try {
27+
if(!config.isSkipScan()) {
28+
new DatabaseBuilder();
29+
}
30+
switch (config.getMetaphor()) {
31+
case CITY: {
32+
new JQA2City();
33+
new JQA2JSON();
34+
new City2City();
35+
switch (config.getOutputFormat()) {
36+
case X3D:
37+
new City2X3D(); break;
38+
case AFrame:
39+
new City2AFrame(); break;
40+
}
41+
break;
42+
}
43+
case RD: {
44+
new JQA2RD();
45+
new JQA2JSON();
46+
new RD2RD();
47+
switch (config.getOutputFormat()) {
48+
case X3D: {
49+
new RD2X3D();
50+
break;
51+
}
52+
case AFrame: {
53+
new RD2AFrame();
54+
break;
55+
}
56+
}
57+
break;
58+
}
59+
}
60+
61+
} catch (Exception e) {
62+
log.error(e);
63+
}
1864
}
1965
}

generator2/org.getaviz.generator/src/main/java/org/getaviz/generator/GeneratorServlet.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,18 @@
1010

1111
public class GeneratorServlet extends HttpServlet {
1212
private static final long serialVersionUID = -5343549433924172589L;
13-
private static final Log log = LogFactory.getLog(GeneratorServlet.class);
13+
private static Log log = LogFactory.getLog(GeneratorServlet.class);
1414

1515
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
1616
log.info("GET request generator");
17-
SettingsConfiguration config = SettingsConfiguration.getInstance("/opt/config/settings.properties");
18-
Generator generator = new Generator(config);
19-
generator.run();
17+
Generator.run();
2018
writeGetResponse(response);
2119
}
2220

2321
public void doPost(HttpServletRequest request, HttpServletResponse response) {
2422
log.info("POST request generator");
2523
SettingsConfiguration config = SettingsConfiguration.getInstance(request);
26-
Generator generator = new Generator(config);
27-
generator.run();
24+
Generator.run();
2825
writePostResponse(response);
2926
}
3027

generator2/org.getaviz.generator/src/main/java/org/getaviz/generator/Metaphor.java

Lines changed: 0 additions & 7 deletions
This file was deleted.

generator2/org.getaviz.generator/src/main/java/org/getaviz/generator/MetaphorFactory.java

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
package org.getaviz.generator;
2+
3+
import org.getaviz.generator.SettingsConfiguration.BuildingType;
4+
import org.getaviz.generator.city.m2m.CityLayout;
5+
import org.getaviz.generator.city.m2m.Rectangle;
6+
7+
public class OutputFormatHelper {
8+
static SettingsConfiguration config = SettingsConfiguration.getInstance();
9+
10+
public static String X3DHead() {
11+
StringBuilder builder = new StringBuilder();
12+
builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
13+
builder.append("\n");
14+
builder.append(
15+
"<!DOCTYPE X3D PUBLIC \"ISO//Web3D//DTD X3D 3.3//EN\" \"http://www.web3d.org/specifications/x3d-3.3.dtd\">");
16+
builder.append("\n");
17+
builder.append(
18+
"<X3D profile=\'Immersive\' version=\'3.3\' xmlns:xsd=\'http://www.w3.org/2001/XMLSchema-instance\' xsd:noNamespaceSchemaLocation=\'http://www.web3d.org/specifications/x3d-3.3.xsd\'>");
19+
builder.append("\n");
20+
builder.append(" <head>");
21+
builder.append("\n");
22+
builder.append(" <meta content=\'model.x3d\' name=\'title\'/>");
23+
builder.append("\n");
24+
builder.append(" <meta content=\'SVIS-Generator\' name=\'creator\'/>");
25+
builder.append("\n");
26+
builder.append("\t </head>");
27+
builder.append("\n");
28+
builder.append("\t <ContextSetup zWriteTrans=\'false\'/>");
29+
builder.append("\n");
30+
builder.append("<Scene>");
31+
builder.append("\n");
32+
return builder.toString();
33+
}
34+
35+
public static String settingsInfo() {
36+
StringBuilder builder = new StringBuilder();
37+
builder.append("<SettingsInfo ClassElements=\'" + config.getClassElementsMode());
38+
builder.append("\' SortModeCoarse=\'" + config.getClassElementsSortModeCoarse());
39+
builder.append("\' SortModeFine=\'" + config.getClassElementsSortModeFine());
40+
builder.append("\' SortModeFineReversed=\'" + config.isClassElementsSortModeFineDirectionReversed());
41+
builder.append("\' Scheme=\'" + config.getScheme());
42+
builder.append("\' ShowBuildingBase=\'" + config.isShowBuildingBase() + "\'");
43+
builder.append("\n");
44+
if (config.getBuildingType() == BuildingType.CITY_BRICKS) {
45+
builder.append("BrickLayout=\'" + config.getBrickLayout() + "\'");
46+
builder.append("\n");
47+
} else if (config.getBuildingType() == BuildingType.CITY_PANELS) {
48+
builder.append("AttributesAsCylinders=\'" + config.isShowAttributesAsCylinders());
49+
builder.append("\' PanelSeparatorMode=\'" + config.getPanelSeparatorMode() + "\'");
50+
builder.append("\n");
51+
}
52+
builder.append("/>");
53+
builder.append("\n");
54+
return builder.toString();
55+
}
56+
57+
public static String viewports() {
58+
Rectangle rootEntity = CityLayout.rootRectangle;
59+
double width = rootEntity.getWidth();
60+
double length = rootEntity.getLength();
61+
StringBuilder builder = new StringBuilder();
62+
builder.append("<Group DEF=\'Viewpoints\'>");
63+
builder.append("\n");
64+
builder.append("\t <Viewpoint description=\'Initial\' position=\'" + width * 0.5 + " "
65+
+ ((width + length) / 2) * 0.25);
66+
builder.append("\' orientation=\'0 1 0 4\' centerOfRotation=\'" + width / 2 + " 0 " + length / 2 + "\'/>");
67+
builder.append("\n");
68+
builder.append("\t Viewpoint description=\'Opposite Side\' position=\'" + width * 1.5 + " "
69+
+ ((width + length) / 2) * 0.25 + " " + length * 1.5);
70+
builder.append("\' orientation=\'0 1 0 0.8\' centerOfRotation=\'" + width / 2 + " 0 " + length / 2 + "\'/>");
71+
builder.append("\n");
72+
builder.append("\t <Viewpoint description=\'Screenshot\' position=\'" + -width * 0.5 + " "
73+
+ ((width + length) / 2) * 0.75 + " " + -length * 0.5);
74+
builder.append(
75+
"\' orientation=\'0.1 0.95 0.25 3.8\' centerOfRotation=\'" + width / 2 + " 0 " + length / 2 + "\'/>");
76+
builder.append("\n");
77+
builder.append("\t <Viewpoint description=\'Screenshot Opposite Side\' position=\'" + width * 1.5 + " "
78+
+ ((width + length) / 2) * 0.75 + " " + length * 1.5);
79+
builder.append(
80+
"\' orientation=\'-0.5 0.85 0.2 0.8\' centerOfRotation=\'" + width / 2 + " 0 " + length / 2 + "\'/>");
81+
builder.append("\n");
82+
builder.append("</Group>");
83+
builder.append("\n");
84+
return builder.toString();
85+
}
86+
87+
public static String X3DTail() {
88+
StringBuilder builder = new StringBuilder();
89+
builder.append(
90+
"\t<Background DEF=\"_Background\" groundColor=\'1.0000000 1.0000000 1.0000000\' skyColor=\'1.0000000 1.0000000 1.0000000\'/>");
91+
builder.append("\n");
92+
builder.append("\t</Scene>");
93+
builder.append("\n");
94+
builder.append("</X3D>");
95+
builder.append("\n");
96+
return builder.toString();
97+
}
98+
99+
public static String AFrameHead() {
100+
StringBuilder builder = new StringBuilder();
101+
builder.append("<!DOCTYPE html>");
102+
builder.append("\n");
103+
builder.append("<html>");
104+
builder.append("\n");
105+
builder.append("\t <head>");
106+
builder.append("\n");
107+
builder.append("\t\t <meta charset=\"utf-8\">");
108+
builder.append("\n");
109+
builder.append("\t <title>Ring</title>");
110+
builder.append("\n");
111+
builder.append("\t <meta name=\"description\" content=\"Getaviz\">");
112+
builder.append("\n");
113+
builder.append("\t </head>");
114+
builder.append("\n");
115+
builder.append("\t <body>");
116+
builder.append("\n");
117+
builder.append("\t\t <a-scene id=\"aframe-canvas\"");
118+
builder.append("\n");
119+
builder.append("\t \t light=\"defaultLightsEnabled: false\"");
120+
builder.append("\n");
121+
builder.append("\t \t cursor=\"rayOrigin: mouse\"");
122+
builder.append("\n");
123+
builder.append("\t \t embedded=\"true\"");
124+
builder.append("\n");
125+
builder.append("\t >");
126+
builder.append("\n");
127+
builder.append("\t\t <a-entity");
128+
builder.append("\n");
129+
builder.append("\t\t \t id=\"camera\"");
130+
builder.append("\n");
131+
builder.append("\t\t \t camera=\"fov: 80; zoom: 1;\"");
132+
builder.append("\n");
133+
builder.append("\t\t \t position=\"44.0 20.0 44.0\"");
134+
builder.append("\n");
135+
builder.append("\t\t \t");
136+
builder.append("rotation=\"0 -90 0\"");
137+
builder.append("\n");
138+
builder.append("\t\t \t orbit-camera=\"");
139+
builder.append("\n");
140+
builder.append("\t\t \t \t target: 15.0 1.5 15.0;");
141+
builder.append("\n");
142+
builder.append("\t\t \t \t enableDamping: true;");
143+
builder.append("\n");
144+
builder.append("\t\t \t \t dampingFactor: 0.25;");
145+
builder.append("\n");
146+
builder.append("\t\t \t \t rotateSpeed: 0.25;");
147+
builder.append("\n");
148+
builder.append("\t\t \t \t panSpeed: 0.25;");
149+
builder.append("\n");
150+
builder.append("\t\t \t \t invertZoom: true;");
151+
builder.append("\n");
152+
builder.append("\t\t \t \t logPosition: false;");
153+
builder.append("\n");
154+
builder.append("\t\t \t \t minDistance:0;");
155+
builder.append("\n");
156+
builder.append("\t\t \t \t maxDistance:1000;");
157+
builder.append("\n");
158+
builder.append("\t\t \t \t \"");
159+
builder.append("\n");
160+
builder.append("\t\t \t mouse-cursor=\"\"");
161+
builder.append("\n");
162+
builder.append("\t\t \t\t >");
163+
builder.append("\n");
164+
builder.append("\t\t </a-entity>");
165+
builder.append("\n");
166+
return builder.toString();
167+
}
168+
169+
public static String AFrameTail() {
170+
StringBuilder builder = new StringBuilder();
171+
builder.append("\t\t </a-scene>");
172+
builder.append("\n");
173+
builder.append(" \t </body>");
174+
builder.append("\n");
175+
builder.append("</html>");
176+
builder.append("\n");
177+
return builder.toString();
178+
}
179+
}

0 commit comments

Comments
 (0)