Skip to content

Commit fae6435

Browse files
committed
cleanup: proper server plugin project structure, corrected markdown, removed obsolete patch (changes made it into Bimserver trunk)
1 parent d953db5 commit fae6435

File tree

9 files changed

+148
-259
lines changed

9 files changed

+148
-259
lines changed

README

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

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
This project started at openBIMweek 2011.
2+
Now maintained by the community.
3+
4+
ThreeJs viewer consists of a server side part (serializer plugin) and a clientside part (ThreeJs based javascript scenegraph).
5+
6+
In order to add the plugin to your BimServer instance, just grab the plugin jar file from downloads and drop it into the BimServer plugin folder.
7+
8+
If you want to develop the serializer, do the following:
9+
10+
1. checkout the BimServer source code and setup your IDE for BimServer development, e.g. for Eclipse as [explained here](http://code.google.com/p/bimserver/wiki/Eclipse)
11+
2. create a new project (Eclipse) or module (other IDEs) and checkout the ServerPlugin
12+
3. Add the following line to org.bimserver.LocalDePluginLoader.java:
13+
pluginManager.loadPluginsFromEclipseProject(new File("../JsonModelFormat2Serializer"));
14+
15+
The plugin will now be visible in the bimserver webinterface and you can download files on "ThreeJs" json format to show in the ThreeJs client.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<PluginDescriptor>
3-
<PluginImplementation>
4-
<interfaceClass>org.bimserver.plugins.serializers.SerializerPlugin</interfaceClass>
5-
<implementationClass>org.bimserver.serializers.json.JSONModelFormat2SerializerPlugin</implementationClass>
6-
</PluginImplementation>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<PluginDescriptor>
3+
<PluginImplementation>
4+
<interfaceClass>org.bimserver.plugins.serializers.SerializerPlugin</interfaceClass>
5+
<implementationClass>org.bimserver.serializers.json.JSONModelFormat2SerializerPlugin</implementationClass>
6+
</PluginImplementation>
77
</PluginDescriptor>

ServerPlugin/rest_json.patch

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
package org.bimserver.serializers.json.data;
2-
3-
import java.io.IOException;
4-
import java.io.OutputStream;
5-
import java.util.ArrayList;
6-
import java.util.List;
7-
8-
import org.bimserver.utils.LittleEndianBinUtils;
9-
10-
public class BinaryIndexBuffer {
11-
12-
private final List<Integer> indices = new ArrayList<Integer>();
13-
14-
public void addIndex(int index) {
15-
indices.add(index);
16-
}
17-
18-
public int getNrIndices() {
19-
return indices.size();
20-
}
21-
22-
public List<Integer> getIndices() {
23-
return indices;
24-
}
25-
26-
public void serialize(OutputStream outputStream) throws IOException {
27-
outputStream.write(LittleEndianBinUtils.intToByteArray(indices.size()));
28-
for (Integer index : indices) {
29-
outputStream.write(LittleEndianBinUtils.intToByteArray(index));
30-
}
31-
}
1+
package org.bimserver.serializers.json;
2+
3+
import java.io.IOException;
4+
import java.io.OutputStream;
5+
import java.util.ArrayList;
6+
import java.util.List;
7+
8+
import org.bimserver.utils.LittleEndianBinUtils;
9+
10+
public class BinaryIndexBuffer {
11+
12+
private final List<Integer> indices = new ArrayList<Integer>();
13+
14+
public void addIndex(int index) {
15+
indices.add(index);
16+
}
17+
18+
public int getNrIndices() {
19+
return indices.size();
20+
}
21+
22+
public List<Integer> getIndices() {
23+
return indices;
24+
}
25+
26+
public void serialize(OutputStream outputStream) throws IOException {
27+
outputStream.write(LittleEndianBinUtils.intToByteArray(indices.size()));
28+
for (Integer index : indices) {
29+
outputStream.write(LittleEndianBinUtils.intToByteArray(index));
30+
}
31+
}
3232
}
Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
package org.bimserver.serializers.json.data;
2-
3-
import java.io.IOException;
4-
import java.io.OutputStream;
5-
import java.util.ArrayList;
6-
import java.util.List;
7-
8-
import org.bimserver.utils.LittleEndianBinUtils;
9-
10-
public class BinaryVertexBuffer {
11-
12-
private final List<Float> vertices = new ArrayList<Float>();
13-
private final List<Float> normals = new ArrayList<Float>();
14-
15-
public void addVertex(float vertex) {
16-
getVertices().add(vertex);
17-
}
18-
19-
public int getNrVertices() {
20-
return getVertices().size();
21-
}
22-
23-
public void serialize(OutputStream outputStream) throws IOException {
24-
outputStream.write(LittleEndianBinUtils.intToByteArray(getVertices().size()/6));
25-
for (Float vertex : getVertices()) {
26-
outputStream.write(LittleEndianBinUtils.floatToByteArray(vertex));
27-
}
28-
}
29-
30-
public List<Float> getVertices() {
31-
return vertices;
32-
}
33-
34-
public void addNormal(float normal) {
35-
normals.add(normal);
36-
}
37-
38-
public List<Float> getNormals() {
39-
return normals;
40-
}
41-
}
1+
package org.bimserver.serializers.json;
2+
3+
import java.io.IOException;
4+
import java.io.OutputStream;
5+
import java.util.ArrayList;
6+
import java.util.List;
7+
8+
import org.bimserver.utils.LittleEndianBinUtils;
9+
10+
public class BinaryVertexBuffer {
11+
12+
private final List<Float> vertices = new ArrayList<Float>();
13+
private final List<Float> normals = new ArrayList<Float>();
14+
15+
public void addVertex(float vertex) {
16+
getVertices().add(vertex);
17+
}
18+
19+
public int getNrVertices() {
20+
return getVertices().size();
21+
}
22+
23+
public void serialize(OutputStream outputStream) throws IOException {
24+
outputStream.write(LittleEndianBinUtils.intToByteArray(getVertices().size()/6));
25+
for (Float vertex : getVertices()) {
26+
outputStream.write(LittleEndianBinUtils.floatToByteArray(vertex));
27+
}
28+
}
29+
30+
public List<Float> getVertices() {
31+
return vertices;
32+
}
33+
34+
public void addNormal(float normal) {
35+
normals.add(normal);
36+
}
37+
38+
public List<Float> getNormals() {
39+
return normals;
40+
}
41+
}

ServerPlugin/JSONModelFormat2Serializer.java renamed to ServerPlugin/src/org/bimserver/serializers/json/JSONModelFormat2Serializer.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
import org.bimserver.emf.IdEObject;
44
import org.bimserver.ifc.IfcModel;
55
import org.bimserver.models.ifc2x3.*;
6-
import org.bimserver.serializers.json.data.BinaryIndexBuffer;
7-
import org.bimserver.serializers.json.data.BinaryVertexBuffer;
8-
import org.bimserver.serializers.json.data.SetGeometryResult;
96
import org.bimserver.plugins.PluginException;
107
import org.bimserver.plugins.PluginManager;
118
import org.bimserver.plugins.ifcengine.*;

ServerPlugin/JSONModelFormat2SerializerPlugin.java renamed to ServerPlugin/src/org/bimserver/serializers/json/JSONModelFormat2SerializerPlugin.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,11 @@ public String getDescription() {
2626
return "JSONModelFormat2Serializer"; // TODO: better names and descriptions
2727
}
2828

29-
30-
// @Override
31-
// public String getName() {
32-
// return getClass().getName();
33-
// }
34-
3529
@Override
3630
public String getVersion() {
3731
return "0.1";
3832
}
3933

40-
// @Override
41-
// public Set<Class<? extends Plugin>> getRequiredPlugins() {
42-
// Set<Class<? extends Plugin>> set = new HashSet<Class<? extends Plugin>>();
43-
// set.add(SchemaPlugin.class);
44-
// set.add(IfcEnginePlugin.class);
45-
// return set;
46-
// }
47-
4834
@Override
4935
public void init(PluginManager pluginManager) throws PluginException {
5036
pluginManager.requireSchemaDefinition();

0 commit comments

Comments
 (0)