@@ -71,24 +71,20 @@ private String toAFrameModel() {
7171 StringBuilder buildings = new StringBuilder ();
7272 StringBuilder segments = new StringBuilder ();
7373 connector .executeRead (
74- "MATCH (n:Model)-[:CONTAINS*]->(d:District)-[:HAS]->(p:Position) WHERE n.building_type = \' "
75- + buildingTypeAsString + "\' RETURN d,p" )
76- .forEachRemaining ((record ) -> {
77- districts .append (toDistrict (record .get ("d" ).asNode (), record .get ("p" ).asNode ()));
78- });
74+ "MATCH (n:Model)-[:CONTAINS*]->(d:District)-[:HAS]->(p:Position) WHERE n.building_type = '"
75+ + buildingTypeAsString + "' RETURN d,p" )
76+ .forEachRemaining ((record ) -> districts .append (toDistrict (record .get ("d" ).asNode (), record .get ("p" ).asNode ())));
7977 if (buildingType == BuildingType .CITY_ORIGINAL || showBuildingBase ) {
8078 connector .executeRead (
81- "MATCH (n:Model)-[:CONTAINS*]->(b:Building)-[:HAS]->(p:Position) WHERE n.building_type = \' "
82- + buildingTypeAsString + "\' RETURN b,p" )
83- .forEachRemaining ((record ) -> {
84- buildings .append (toBuilding (record .get ("b" ).asNode (), record .get ("p" ).asNode ()));
85- });
79+ "MATCH (n:Model)-[:CONTAINS*]->(b:Building)-[:HAS]->(p:Position) WHERE n.building_type = '"
80+ + buildingTypeAsString + "' RETURN b,p" )
81+ .forEachRemaining ((record ) -> buildings .append (toBuilding (record .get ("b" ).asNode (), record .get ("p" ).asNode ())));
8682 }
8783
8884 if (!(buildingType == BuildingType .CITY_ORIGINAL )) {
8985 connector .executeRead (
90- "MATCH (n:Model)-[:CONTAINS*]->(bs:BuildingSegment)-[:HAS]->(p:Position) WHERE n.building_type = \ ' "
91- + buildingTypeAsString + "\ ' RETURN bs,p" )
86+ "MATCH (n:Model)-[:CONTAINS*]->(bs:BuildingSegment)-[:HAS]->(p:Position) WHERE n.building_type = '"
87+ + buildingTypeAsString + "' RETURN bs,p" )
9288 .forEachRemaining ((record ) -> {
9389 Node segment = record .get ("bs" ).asNode ();
9490 if (segment .hasLabel (Labels .Floor .name ())) {
@@ -105,42 +101,38 @@ private String toAFrameModel() {
105101
106102 private String toDistrict (Node district , Node position ) {
107103 Node entity = connector .getVisualizedEntity (district .id ());
108- StringBuilder builder = new StringBuilder ();
109- builder .append ("<a-box id=\" " + entity .get ("hash" ).asString () + "\" " );
110- builder .append ("\n " );
111- builder .append ("\t position=\" " + position .get ("x" ) + " " + position .get ("y" ) + " " + position .get ("z" ) + "\" " );
112- builder .append ("\n " );
113- builder .append ("\t width=\" " + district .get ("width" ) + "\" " );
114- builder .append ("\n " );
115- builder .append ("\t height=\" " + district .get ("height" ) + "\" " );
116- builder .append ("\n " );
117- builder .append ("\t depth=\" " + district .get ("length" ) + "\" " );
118- builder .append ("\n " );
119- builder .append ("\t color=\" " + district .get ("color" ).asString () + "\" >" );
120- builder .append ("\n " );
121- builder .append ("</a-box>" );
122- builder .append ("\n " );
123- return builder .toString ();
104+ return "<a-box id=\" " + entity .get ("hash" ).asString () + "\" " +
105+ "\n " +
106+ "\t position=\" " + position .get ("x" ) + " " + position .get ("y" ) + " " + position .get ("z" ) + "\" " +
107+ "\n " +
108+ "\t width=\" " + district .get ("width" ) + "\" " +
109+ "\n " +
110+ "\t height=\" " + district .get ("height" ) + "\" " +
111+ "\n " +
112+ "\t depth=\" " + district .get ("length" ) + "\" " +
113+ "\n " +
114+ "\t color=\" " + district .get ("color" ).asString () + "\" >" +
115+ "\n " +
116+ "</a-box>" +
117+ "\n " ;
124118 }
125119
126120 private String toBuilding (Node building , Node position ) {
127121 Node entity = connector .getVisualizedEntity (building .id ());
128- StringBuilder builder = new StringBuilder ();
129- builder .append ("<a-box id=\" " + entity .get ("hash" ).asString () + "\" " );
130- builder .append (
131- "\t \t position=\" " + position .get ("x" ) + " " + position .get ("y" ) + " " + position .get ("z" ) + "\" " );
132- builder .append ("\n " );
133- builder .append ("\t \t width=\" " + building .get ("width" ) + "\" " );
134- builder .append ("\n " );
135- builder .append ("\t \t height=\" " + building .get ("height" ) + "\" " );
136- builder .append ("\n " );
137- builder .append ("\t \t depth=\" " + building .get ("length" ) + "\" " );
138- builder .append ("\n " );
139- builder .append ("\t \t color=\" " + building .get ("color" ).asString () + "\" >" );
140- builder .append ("\n " );
141- builder .append ("</a-box>" );
142- builder .append ("\n " );
143- return builder .toString ();
122+ String builder = "<a-box id=\" " + entity .get ("hash" ).asString () + "\" " +
123+ "\t \t position=\" " + position .get ("x" ) + " " + position .get ("y" ) + " " + position .get ("z" ) + "\" " +
124+ "\n " +
125+ "\t \t width=\" " + building .get ("width" ) + "\" " +
126+ "\n " +
127+ "\t \t height=\" " + building .get ("height" ) + "\" " +
128+ "\n " +
129+ "\t \t depth=\" " + building .get ("length" ) + "\" " +
130+ "\n " +
131+ "\t \t color=\" " + building .get ("color" ).asString () + "\" >" +
132+ "\n " +
133+ "</a-box>" +
134+ "\n " ;
135+ return builder ;
144136 }
145137
146138 private String buildPosition (Node position ) {
@@ -154,24 +146,22 @@ private String buildColor(Node segment) {
154146 private String toBuildingSegment (Node segment , Node position ) {
155147 Node entity = connector .getVisualizedEntity (segment .id ());
156148 List <Node > separators = new ArrayList <>();
157- connector .executeRead ("MATCH (n)-[:HAS]->(ps:PanelSeparator) RETURN ps" ).forEachRemaining ((record ) -> {
158- separators .add (record .get ("ps" ).asNode ());
159- });
149+ connector .executeRead ("MATCH (n)-[:HAS]->(ps:PanelSeparator) RETURN ps" ).forEachRemaining ((record ) -> separators .add (record .get ("ps" ).asNode ()));
160150 double width = segment .get ("width" ).asDouble ();
161151 double height = segment .get ("height" ).asDouble ();
162152 double length = segment .get ("length" ).asDouble ();
163153 StringBuilder builder = new StringBuilder ();
164154 if (buildingType == BuildingType .CITY_PANELS && entity .hasLabel (Labels .Field .name ())
165155 && showAttributesAsCylinders ) {
166- builder .append ("<a-cylinder id=\" " + entity .get ("hash" ).asString () + "\" " );
156+ builder .append ("<a-cylinder id=\" " ). append ( entity .get ("hash" ).asString ()). append ( "\" " );
167157 builder .append ("\n " );
168158 builder .append (buildPosition (position ));
169159 builder .append ("\n " );
170- builder .append ("\t radius=\" " + width / 2 + "\" " );
160+ builder .append ("\t radius=\" " ). append ( width / 2 ). append ( "\" " );
171161 builder .append ("\n " );
172162 builder .append ("\t height=\" " + "\" " );
173163 builder .append ("\n " );
174- builder .append ("\t color=\" " + segment .get ("color" ).asString () + "\" " );
164+ builder .append ("\t color=\" " ). append ( segment .get ("color" ).asString ()). append ( "\" " );
175165 builder .append ("\n " );
176166 builder .append ("\t segments-height=\" 2\" " );
177167 builder .append ("\n " );
@@ -180,17 +170,17 @@ private String toBuildingSegment(Node segment, Node position) {
180170 builder .append ("</a-cylinder>" );
181171 builder .append ("\n " );
182172 } else {
183- builder .append ("<a-box id=\" " + entity .get ("hash" ).asString () + "\" " );
173+ builder .append ("<a-box id=\" " ). append ( entity .get ("hash" ).asString ()). append ( "\" " );
184174 builder .append ("\n " );
185175 builder .append (buildPosition (position ));
186176 builder .append ("\n " );
187- builder .append ("\t width=\" " + width + "\" " );
177+ builder .append ("\t width=\" " ). append ( width ). append ( "\" " );
188178 builder .append ("\n " );
189- builder .append ("\t height=\" " + height + "\" " );
179+ builder .append ("\t height=\" " ). append ( height ). append ( "\" " );
190180 builder .append ("\n " );
191- builder .append ("\t depth=\" " + length + "\" " );
181+ builder .append ("\t depth=\" " ). append ( length ). append ( "\" " );
192182 builder .append ("\n " );
193- builder .append (buildColor (segment ) + ">" );
183+ builder .append (buildColor (segment )). append ( ">" );
194184 builder .append ("\n " );
195185 builder .append ("</a-box>" );
196186 builder .append ("\n " );
@@ -199,15 +189,15 @@ private String toBuildingSegment(Node segment, Node position) {
199189 final Node pos = connector .getPosition (separator .id ());
200190 builder .append ("\n " );
201191 if (separator .hasLabel (Labels .Cylinder .name ())) {
202- builder .append ("<a-cylinder id=\" " + entity .get ("hash" ).asString () + "\" " );
192+ builder .append ("<a-cylinder id=\" " ). append ( entity .get ("hash" ).asString ()). append ( "\" " );
203193 builder .append ("\n " );
204194 builder .append (buildPosition (pos ));
205195 builder .append ("\n " );
206- builder .append ("\t radius=\" " + separator .get ("radius" ) + "\" " );
196+ builder .append ("\t radius=\" " ). append ( separator .get ("radius" )). append ( "\" " );
207197 builder .append ("\n " );
208- builder .append ("\t height=\" " + panelSeparatorHeight + "\" " );
198+ builder .append ("\t height=\" " ). append ( panelSeparatorHeight ). append ( "\" " );
209199 builder .append ("\n " );
210- builder .append ("\t color=\" " + color + "\" " );
200+ builder .append ("\t color=\" " ). append ( color ). append ( "\" " );
211201 builder .append ("\n " );
212202 builder .append ("\t segments-height=\" 2\" " );
213203 builder .append ("\n " );
@@ -216,17 +206,17 @@ private String toBuildingSegment(Node segment, Node position) {
216206 builder .append ("</a-cylinder>" );
217207 builder .append ("\n " );
218208 } else {
219- builder .append ("<a-box id=\" " + entity .get ("hash" ).asString () + "\" " );
209+ builder .append ("<a-box id=\" " ). append ( entity .get ("hash" ).asString ()). append ( "\" " );
220210 builder .append ("\n " );
221211 builder .append (buildPosition (pos ));
222212 builder .append ("\n " );
223- builder .append ("\t width=\" " + separator .get ("width" ) + "\" " );
213+ builder .append ("\t width=\" " ). append ( separator .get ("width" )). append ( "\" " );
224214 builder .append ("\n " );
225- builder .append ("\t height=\" " + panelSeparatorHeight + "\" " );
215+ builder .append ("\t height=\" " ). append ( panelSeparatorHeight ). append ( "\" " );
226216 builder .append ("\n " );
227- builder .append ("\t depth=\" " + separator .get ("length" ) + "\" " );
217+ builder .append ("\t depth=\" " ). append ( separator .get ("length" )). append ( "\" " );
228218 builder .append ("\n " );
229- builder .append ("\t color=\" " + color + "\" >" );
219+ builder .append ("\t color=\" " ). append ( color ). append ( "\" >" );
230220 builder .append ("\n " );
231221 builder .append ("</a-box>" );
232222 builder .append ("\n " );
@@ -237,41 +227,39 @@ private String toBuildingSegment(Node segment, Node position) {
237227
238228 private String toFloor (Node floor , Node position ) {
239229 Node entity = connector .getVisualizedEntity (floor .id ());
240- StringBuilder builder = new StringBuilder ();
241- builder .append ("<a-box id=\" " + entity .get ("hash" ).asString () + "\" " );
242- builder .append ("\n " );
243- builder .append (buildPosition (position ));
244- builder .append ("\n " );
245- builder .append ("\t width=\" " + floor .get ("width" ) + "\" " );
246- builder .append ("\n " );
247- builder .append ("\t height=\" " + floor .get ("height" ) + "\" " );
248- builder .append ("\n " );
249- builder .append ("\t depth=\" " + floor .get ("length" ) + "\" " );
250- builder .append ("\n " );
251- builder .append ("\t color=\" " + floor .get ("color" ).asString () + "\" >" );
252- builder .append ("\n " );
253- builder .append ("</a-box>" );
254- builder .append ("\n " );
255- return builder .toString ();
230+ String builder = "<a-box id=\" " + entity .get ("hash" ).asString () + "\" " +
231+ "\n " +
232+ buildPosition (position ) +
233+ "\n " +
234+ "\t width=\" " + floor .get ("width" ) + "\" " +
235+ "\n " +
236+ "\t height=\" " + floor .get ("height" ) + "\" " +
237+ "\n " +
238+ "\t depth=\" " + floor .get ("length" ) + "\" " +
239+ "\n " +
240+ "\t color=\" " + floor .get ("color" ).asString () + "\" >" +
241+ "\n " +
242+ "</a-box>" +
243+ "\n " ;
244+ return builder ;
256245 }
257246
258247 private String toChimney (Node chimney , Node position ) {
259- Node entity = connector .getVisualizedEntity (chimney .id ());
260- StringBuilder builder = new StringBuilder ();
261- builder .append ("<a-box id=\" " + entity .get ("hash" ).asString () + "\" " );
262- builder .append ("\n " );
263- builder .append (buildPosition (position ));
264- builder .append ("\n " );
265- builder .append ("\t width=\" " + chimney .get ("width" ) + "\" " );
266- builder .append ("\n " );
267- builder .append ("\t height=\" " + chimney .get ("height" ) + "\" " );
268- builder .append ("\n " );
269- builder .append ("\t depth=\" " + chimney .get ("length" ) + "\" " );
270- builder .append ("\n " );
271- builder .append ("\t color=\" " + chimney .get ("color" ).asString () + "\" >" );
272- builder .append ("\n " );
273- builder .append ("</a-box>" );
274- builder .append ("\n " );
275- return builder .toString ();
248+ Node entity = connector .getVisualizedEntity (chimney .id ());
249+ String builder = "<a-box id=\" " + entity .get ("hash" ).asString () + "\" " +
250+ "\n " +
251+ buildPosition (position ) +
252+ "\n " +
253+ "\t width=\" " + chimney .get ("width" ) + "\" " +
254+ "\n " +
255+ "\t height=\" " + chimney .get ("height" ) + "\" " +
256+ "\n " +
257+ "\t depth=\" " + chimney .get ("length" ) + "\" " +
258+ "\n " +
259+ "\t color=\" " + chimney .get ("color" ).asString () + "\" >" +
260+ "\n " +
261+ "</a-box>" +
262+ "\n " ;
263+ return builder ;
276264 }
277265}
0 commit comments