|
From: <chr...@us...> - 2012-08-18 08:49:28
|
Revision: 976
http://openautomation.svn.sourceforge.net/openautomation/?rev=976&view=rev
Author: christian523
Date: 2012-08-18 08:49:22 +0000 (Sat, 18 Aug 2012)
Log Message:
-----------
New plugin for displaying a blind-status with a svg-file.
Added Paths:
-----------
CometVisu/trunk/visu/plugins/svg/
CometVisu/trunk/visu/plugins/svg/rollo.svg
CometVisu/trunk/visu/plugins/svg/structure_plugin.js
Added: CometVisu/trunk/visu/plugins/svg/rollo.svg
===================================================================
--- CometVisu/trunk/visu/plugins/svg/rollo.svg (rev 0)
+++ CometVisu/trunk/visu/plugins/svg/rollo.svg 2012-08-18 08:49:22 UTC (rev 976)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1"
+ width="48"
+ height="48"
+ id="svg2">
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g stroke="#FFFFFF" >
+ <line id="line1" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line2" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line3" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line4" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line5" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line6" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line7" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line8" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line9" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line10" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line11" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line12" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line13" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line14" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line15" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line16" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line17" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line18" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line19" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <line id="line20" x1="2" x2="46" y1="9" y2="9" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" fill="none"/>
+ <path id="windowframe" d="m3,5 l42,0 l0,38 l-42,0 l0,-38" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" stroke="#FEFEFE" fill="none" />
+ <rect id="toprect" x="1" y="5" width="46" height="4" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" stroke="#FEFEFE" fill="#FEFEFE" />
+ <line id="middleline" x1="24" x2="24" y1="5" y2="43" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" stroke="#FEFEFE" fill="none"/>
+ <line id="grip" x1="22" x2="26" y1="25" y2="25" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" stroke="#FEFEFE" fill="none"/>
+ </g>
+</svg>
Added: CometVisu/trunk/visu/plugins/svg/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/svg/structure_plugin.js (rev 0)
+++ CometVisu/trunk/visu/plugins/svg/structure_plugin.js 2012-08-18 08:49:22 UTC (rev 976)
@@ -0,0 +1,88 @@
+/* structure_plugin.js (c) 2010 by Christian Mayer [CometVisu at ChristianMayer dot de]
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+*/
+
+/**
+ * This is a custom function that extends the available widgets.
+ * It's purpose is to change the design of the visu during runtime
+ * to demonstrate all available
+ */
+VisuDesign_Custom.prototype.addCreator('svg', {
+ create: function( element, path, flavour, type ) {
+ var $e = $(element);
+ var layout = $e.children('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout, type ) + '"' : '';
+ var ret_val = $('<div class="widget clearfix image" ' + style + '/>');
+ ret_val.setWidgetLayout($e);
+ ret_val.append( extractLabel( $e.find('label')[0] ) );
+
+ var address = {};
+ $e.find('address').each( function(){
+ var src = this.textContent;
+ var transform = this.getAttribute('transform');
+ var color = this.getAttribute('variant' );
+ var readonly = this.getAttribute('readonly' );
+ ga_list.push( src );
+ address[ '_' + src ] = [ transform, color, readonly=='true' ];
+ });
+
+ var actor = '<div class="actor"></div>';
+
+ var $actor = $(actor);
+ $actor.svg({loadURL:'plugins/svg/rollo.svg'});
+
+
+ var refresh = $e.attr('refresh') ? $e.attr('refresh')*1000 : 0;
+ $actor.data( {
+ 'address': address,
+ 'refresh': refresh
+ } ).each(setupRefreshAction); // abuse "each" to call in context...
+ for( var addr in address ) {
+ $actor.bind( addr, this.update );
+ }
+ ret_val.append( $actor );
+ return ret_val;
+ },
+ update: function(e,d) {
+ var element = $(this);
+ var h = defaultUpdate( e, d, element );
+ var linewidth=3;
+ var space = 1;
+ var total = linewidth + space;
+ var line_qty = 48 / total;
+ for(var i = 0; i<=Math.floor(h/line_qty);i++) {
+ element.find('#line'+(i+1)).attr('y1',9+total*(i)+((h%line_qty)/line_qty)*total);
+ element.find('#line'+(i+1)).attr('y2',9+total*(i)+((h%line_qty)/line_qty)*total);
+ }
+ for(var i = Math.floor(h/line_qty)+1; i<=line_qty;i++) {
+ element.find('#line'+(i+1)).attr('y1',9);
+ element.find('#line'+(i+1)).attr('y2',9);
+ }
+ },
+ attributes: {
+ format: { type: 'format' , required: false },
+ mapping: { type: 'mapping', required: false },
+ styling: { type: 'styling', required: false },
+ colspan: { type: 'numeric', required: false },
+ rowspan: { type: 'numeric', required: false }
+ },
+ elements: {
+ label: { type: 'string' , required: true , multi: false },
+ address: { type: 'address', required: true , multi: true },
+ layout: { type: 'layout' , required: false, multi: false }
+ },
+ content: false
+});
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|