|
From: <ma...@us...> - 2012-03-04 21:45:47
|
Revision: 721
http://openautomation.svn.sourceforge.net/openautomation/?rev=721&view=rev
Author: mayerch
Date: 2012-03-04 21:45:41 +0000 (Sun, 04 Mar 2012)
Log Message:
-----------
New feature: 3d pages!!!
This is still more of a quick hack for a proof of concept than a solid integration - but it'll be the base for it.
Modified Paths:
--------------
CometVisu/trunk/visu/designs/structure_pure.js
CometVisu/trunk/visu/index.html
CometVisu/trunk/visu/visu_config_2d3d.xml
JSFloorPlan/trunk/src/jsfloorplan.js
Property Changed:
----------------
CometVisu/trunk/visu/
Property changes on: CometVisu/trunk/visu
___________________________________________________________________
Added: svn:externals
+ lib/jsfloorplan.js https://openautomation.svn.sourceforge.net/svnroot/openautomation/JSFloorPlan/trunk/src/jsfloorplan.js
lib/Three.js https://openautomation.svn.sourceforge.net/svnroot/openautomation/JSFloorPlan/trunk/lib/Three.js
lib/poly2tri.js https://openautomation.svn.sourceforge.net/svnroot/openautomation/JSFloorPlan/trunk/lib/poly2tri.js
media/demo_texture_512x512.png https://openautomation.svn.sourceforge.net/svnroot/openautomation/JSFloorPlan/trunk/media/demo_texture_512x512.png
Modified: CometVisu/trunk/visu/designs/structure_pure.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_pure.js 2012-03-04 19:55:57 UTC (rev 720)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2012-03-04 21:45:41 UTC (rev 721)
@@ -171,6 +171,19 @@
if( '2d' == type )
{
container.append( '<embed src="' + backdrop + '" style="position: absolute; top: 0px; left: 0px;z-index:-1;width:100%;height:100%;"/>' );
+ } else if( '3d' == type )
+ {
+ container.data( 'JSFloorPlan3D', JSFloorPlan3D( container, backdrop ) );
+ if ($p.attr('azimut')) {
+ ga_list.push($p.attr('azimut'));
+ address[ '_' + $p.attr('azimut') ] = [ 'DPT:5.001', 0, 'azimut' ];
+ container.bind( '_' + $p.attr('azimut'), this.update );
+ }
+ if ($p.attr('elevation')) {
+ ga_list.push($p.attr('elevation'));
+ address[ '_' + $p.attr('elevation') ] = [ 'DPT:5.001', 0, 'elevation' ];
+ container.bind( '_' + $p.attr('elevation'), this.update );
+ }; container.data( 'address', address );
}
$( childs ).each( function(i){
container.append( create_pages( childs[i], path + '_' + i, flavour ) );
@@ -190,14 +203,31 @@
type: { type: 'string', required: false },
colspan: { type: 'numeric', required: false },
rowspan: { type: 'numeric', required: false },
- backdrop: { type: 'string', required: false }
+ backdrop: { type: 'string', required: false },
+ azimut: { type: 'addr', required: false },
+ elevation:{ type: 'addr', required: false }
},
elements: {
},
update: function(e, data) {
- if (data==01) {
- scrollToPage(this.attributes.path.nodeValue);
- visu.write(e.type.substr(1), transformEncode("DPT:1.001", 0));
+ var element = $(this);
+ var value = defaultUpdate( e, data, element );
+ var type = element.data().address[ e.type ][2];
+ switch( type )
+ {
+ case 'azimut':
+ element.data().JSFloorPlan3D.setState('currentAzimut', value, true);
+ break;
+
+ case 'elevation':
+ element.data().JSFloorPlan3D.setState('currentElevation', value, true);
+ break;
+
+ default:
+ if (data==01) {
+ scrollToPage(this.attributes.path.nodeValue);
+ visu.write(e.type.substr(1), transformEncode("DPT:1.001", 0));
+ }
}
},
content: true
Modified: CometVisu/trunk/visu/index.html
===================================================================
--- CometVisu/trunk/visu/index.html 2012-03-04 19:55:57 UTC (rev 720)
+++ CometVisu/trunk/visu/index.html 2012-03-04 21:45:41 UTC (rev 721)
@@ -22,6 +22,9 @@
<script src="lib/templateengine.js" type="text/javascript"></script>
<script src="transforms/transform_default.js" type="text/javascript"></script>
<script src="transforms/transform_knx.js" type="text/javascript"></script>
+ <script src="lib/Three.js" type="text/javascript"></script>
+ <script src="lib/poly2tri.js" type="text/javascript"></script>
+ <script src="lib/jsfloorplan.js" type="text/javascript"></script>
<style type="text/css">
.loading { display: none; }
</style>
Modified: CometVisu/trunk/visu/visu_config_2d3d.xml
===================================================================
--- CometVisu/trunk/visu/visu_config_2d3d.xml 2012-03-04 19:55:57 UTC (rev 720)
+++ CometVisu/trunk/visu/visu_config_2d3d.xml 2012-03-04 21:45:41 UTC (rev 721)
@@ -78,8 +78,17 @@
<address transform="DPT:5.001" type="">12/7/52</address>
</info>
</page>
- <page name="3D Demo" >
- <text>not avialable at the moment...</text>
+ <page name="3D Demo" type="3d" backdrop="floorplan_demo.xml" azimut="12/7/53" elevation="12/7/54">
+ <slide min="0" max="6.283185307179586">
+ <layout x="0px" y="570px" width="600px" />
+ <label>Azimut</label>
+ <address transform="DPT:5.001" type="">12/7/53</address>
+ </slide>
+ <slide min="0" max="1.5707963267948966">
+ <layout x="400px" y="570px" width="600px" />
+ <label>Elevation</label>
+ <address transform="DPT:5.001" type="">12/7/54</address>
+ </slide>
</page>
<line/>
</page>
Modified: JSFloorPlan/trunk/src/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/src/jsfloorplan.js 2012-03-04 19:55:57 UTC (rev 720)
+++ JSFloorPlan/trunk/src/jsfloorplan.js 2012-03-04 21:45:41 UTC (rev 721)
@@ -165,10 +165,12 @@
var self = this;
+ /*
if (typeof floorPlan === "string")
{
this.loadFloorPlan( floorPlan );
}
+ */
// public variables of this object instance
this.buildingProperties = { floor: [], Object3D: new THREE.Object3D() };
@@ -205,7 +207,7 @@
lightStrength: 80,
lightDistance: 50,
fillOpacity: 1, // solid
- fillColor: new THREE.Color(0x000000), // black
+ fillColor: new THREE.Color(0xffffff), // white
showNodes: false, // only for debug purposes
showWallLines: false, // only for debug purposes
showWireframe: false, //
@@ -1135,8 +1137,8 @@
var sx = Math.sin(showStates.lightAzimut) * Math.cos(showStates.lightElevation);
var sy = Math.cos(showStates.lightAzimut) * Math.cos(showStates.lightElevation);
var sz = Math.sin(showStates.lightElevation);
- sunLight.target.position = target;
- sunLight.position = new THREE.Vector3( sx * showStates.lightDistance, sy * showStates.lightDistance, sz * showStates.lightDistance + target.z );
+ sunLight.target.position = showStates.currentTarget;
+ sunLight.position = new THREE.Vector3( sx * showStates.lightDistance, sy * showStates.lightDistance, sz * showStates.lightDistance + showStates.currentTarget.z );
sunLight.intensity = showStates.lightStrength / 100.0;
sunLightViewLine.geometry.vertices[0].position = sunLight.position;
sunLightViewLine.geometry.vertices[1].position = sunLight.target.position;
@@ -1397,6 +1399,10 @@
if( event.data.callback ) event.data.callback( event );
}
+ if (typeof floorPlan === "string")
+ {
+ this.loadFloorPlan( floorPlan );
+ }
};
// library local variables
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|