Skip to content

Commit

Permalink
cleanup: proper server plugin project structure, corrected markdown, …
Browse files Browse the repository at this point in the history
…removed obsolete patch (changes made it into Bimserver trunk)
  • Loading branch information
hlg committed Dec 17, 2011
1 parent d953db5 commit fae6435
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 259 deletions.
34 changes: 0 additions & 34 deletions README

This file was deleted.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This project started at openBIMweek 2011.
Now maintained by the community.

ThreeJs viewer consists of a server side part (serializer plugin) and a clientside part (ThreeJs based javascript scenegraph).

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.

If you want to develop the serializer, do the following:

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)
2. create a new project (Eclipse) or module (other IDEs) and checkout the ServerPlugin
3. Add the following line to org.bimserver.LocalDePluginLoader.java:
pluginManager.loadPluginsFromEclipseProject(new File("../JsonModelFormat2Serializer"));

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.
12 changes: 6 additions & 6 deletions ServerPlugin/plugin.xml → ServerPlugin/plugin/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PluginDescriptor>
<PluginImplementation>
<interfaceClass>org.bimserver.plugins.serializers.SerializerPlugin</interfaceClass>
<implementationClass>org.bimserver.serializers.json.JSONModelFormat2SerializerPlugin</implementationClass>
</PluginImplementation>
<?xml version="1.0" encoding="utf-8"?>
<PluginDescriptor>
<PluginImplementation>
<interfaceClass>org.bimserver.plugins.serializers.SerializerPlugin</interfaceClass>
<implementationClass>org.bimserver.serializers.json.JSONModelFormat2SerializerPlugin</implementationClass>
</PluginImplementation>
</PluginDescriptor>
75 changes: 0 additions & 75 deletions ServerPlugin/rest_json.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
package org.bimserver.serializers.json.data;

import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

import org.bimserver.utils.LittleEndianBinUtils;

public class BinaryIndexBuffer {

private final List<Integer> indices = new ArrayList<Integer>();

public void addIndex(int index) {
indices.add(index);
}

public int getNrIndices() {
return indices.size();
}

public List<Integer> getIndices() {
return indices;
}

public void serialize(OutputStream outputStream) throws IOException {
outputStream.write(LittleEndianBinUtils.intToByteArray(indices.size()));
for (Integer index : indices) {
outputStream.write(LittleEndianBinUtils.intToByteArray(index));
}
}
package org.bimserver.serializers.json;

import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

import org.bimserver.utils.LittleEndianBinUtils;

public class BinaryIndexBuffer {

private final List<Integer> indices = new ArrayList<Integer>();

public void addIndex(int index) {
indices.add(index);
}

public int getNrIndices() {
return indices.size();
}

public List<Integer> getIndices() {
return indices;
}

public void serialize(OutputStream outputStream) throws IOException {
outputStream.write(LittleEndianBinUtils.intToByteArray(indices.size()));
for (Integer index : indices) {
outputStream.write(LittleEndianBinUtils.intToByteArray(index));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
package org.bimserver.serializers.json.data;

import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

import org.bimserver.utils.LittleEndianBinUtils;

public class BinaryVertexBuffer {

private final List<Float> vertices = new ArrayList<Float>();
private final List<Float> normals = new ArrayList<Float>();

public void addVertex(float vertex) {
getVertices().add(vertex);
}

public int getNrVertices() {
return getVertices().size();
}

public void serialize(OutputStream outputStream) throws IOException {
outputStream.write(LittleEndianBinUtils.intToByteArray(getVertices().size()/6));
for (Float vertex : getVertices()) {
outputStream.write(LittleEndianBinUtils.floatToByteArray(vertex));
}
}

public List<Float> getVertices() {
return vertices;
}

public void addNormal(float normal) {
normals.add(normal);
}

public List<Float> getNormals() {
return normals;
}
}
package org.bimserver.serializers.json;

import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

import org.bimserver.utils.LittleEndianBinUtils;

public class BinaryVertexBuffer {

private final List<Float> vertices = new ArrayList<Float>();
private final List<Float> normals = new ArrayList<Float>();

public void addVertex(float vertex) {
getVertices().add(vertex);
}

public int getNrVertices() {
return getVertices().size();
}

public void serialize(OutputStream outputStream) throws IOException {
outputStream.write(LittleEndianBinUtils.intToByteArray(getVertices().size()/6));
for (Float vertex : getVertices()) {
outputStream.write(LittleEndianBinUtils.floatToByteArray(vertex));
}
}

public List<Float> getVertices() {
return vertices;
}

public void addNormal(float normal) {
normals.add(normal);
}

public List<Float> getNormals() {
return normals;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import org.bimserver.emf.IdEObject;
import org.bimserver.ifc.IfcModel;
import org.bimserver.models.ifc2x3.*;
import org.bimserver.serializers.json.data.BinaryIndexBuffer;
import org.bimserver.serializers.json.data.BinaryVertexBuffer;
import org.bimserver.serializers.json.data.SetGeometryResult;
import org.bimserver.plugins.PluginException;
import org.bimserver.plugins.PluginManager;
import org.bimserver.plugins.ifcengine.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,11 @@ public String getDescription() {
return "JSONModelFormat2Serializer"; // TODO: better names and descriptions
}


// @Override
// public String getName() {
// return getClass().getName();
// }

@Override
public String getVersion() {
return "0.1";
}

// @Override
// public Set<Class<? extends Plugin>> getRequiredPlugins() {
// Set<Class<? extends Plugin>> set = new HashSet<Class<? extends Plugin>>();
// set.add(SchemaPlugin.class);
// set.add(IfcEnginePlugin.class);
// return set;
// }

@Override
public void init(PluginManager pluginManager) throws PluginException {
pluginManager.requireSchemaDefinition();
Expand Down
Loading

0 comments on commit fae6435

Please sign in to comment.