Mittwoch, 9. März 2011

OpenLayers: Hover & Popup Example

So ive been struggling to get this feature working. Through hard research (reading 5 lines of code) i managed to implement the function without the hassel all the internet smack is talkin bout. So feel free to use this in your project and if you got here by looking into google, leave a comment or a beer coupon or whatever :) because im releasing this under the beerware license.

<code><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>HoverFeature for Highlight - SelectFeature for Popup</title>
    <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
    <link rel="stylesheet" href="style.css" type="text/css" />
    <style type="text/css">
        #controlToggle li {
            list-style: none;
        }
    </style>
    <script src="../lib/Firebug/firebug.js"></script>
    <script src="../lib/OpenLayers.js"></script>

    <script type="text/javascript">
    var selectCtrl;
  
    function onPopupClose(evt) {
            selectCtrl.unselect(selectedFeature);
        }
        function onFeatureSelect(feature) {
            selectedFeature = feature;
            popup = new OpenLayers.Popup.FramedCloud("chicken",
                                     feature.geometry.getBounds().getCenterLonLat(),
                                     null,
                                     "<div style='font-size:.8em'>Feature: " + feature.id +"<br />Area: " + feature.geometry.getArea()+"</div>",
                                     null, true, onPopupClose);
            feature.popup = popup;
            map.addPopup(popup);
        }
        function onFeatureUnselect(feature) {
            map.removePopup(feature.popup);
            feature.popup.destroy();
            feature.popup = null;
        } 

        var map, controls;

        OpenLayers.Feature.Vector.style['default']['strokeWidth'] = '2';

        function init(){
            map = new OpenLayers.Map('map');

            var vectors = new OpenLayers.Layer.Vector("vector", {isBaseLayer: true});
            map.addLayers([vectors]);

            var feature = new OpenLayers.Feature.Vector(
                OpenLayers.Geometry.fromWKT(
                    "POLYGON((28.828125 0.3515625, 132.1875 -13.0078125, -1.40625 -59.4140625, 28.828125 0.3515625))"
                )
            );
            vectors.addFeatures([feature]);

            var feature2 = new OpenLayers.Feature.Vector(
                OpenLayers.Geometry.fromWKT(
                    "POLYGON((-120.828125 -50.3515625, -80.1875 -80.0078125, -40.40625 -20.4140625, -120.828125 -50.3515625))"
                )
            );
            vectors.addFeatures([feature2]);

            var report = function(e) {
                OpenLayers.Console.log(e.type, e.feature.id);
            };
          
            var highlightCtrl = new OpenLayers.Control.SelectFeature(vectors, {
                hover: true,
                highlightOnly: true,
                renderIntent: "temporary",
                eventListeners: {
                    beforefeaturehighlighted: report,
                    featurehighlighted: report,
                    featureunhighlighted: report
                }
            });

            selectCtrl = new OpenLayers.Control.SelectFeature(vectors,
                {onSelect: onFeatureSelect, onUnselect: onFeatureUnselect}
            );
          
            map.addControl(highlightCtrl);
            map.addControl(selectCtrl);
            highlightCtrl.activate();
            selectCtrl.activate();
            map.addControl(new OpenLayers.Control.EditingToolbar(vectors));
            map.setCenter(new OpenLayers.LonLat(0, 0), 1);
        }
    </script>
  </head>
  <body onload="init()">
    <h1 id="title">OpenLayers HoverFeature for Highlight - SelectFeature for Popup Example</h1>
    <p id="shortdesc">
      Activate popup on click, highlight features on hover.
    </p>
    <div id="map" class="smallmap"></div>
    <p>Select features by clicking on them. Just highlight features by hovering over
    them.</p>

  </body>
</html>
</code>

Mittwoch, 2. März 2011

youPad or iPad

Wie man hier lesen kann gehts heute um 19 Uhr los.
Alle Apple Fanboys könnens kaum erwarten.

WOOOOHOOOO.

Dienstag, 1. März 2011

IPAD 2

Das grosse Grauen hat ein ENDE.
Die schlimmste Zeit ist VORBEI.
Das Warten ist VORÜBER.

Ich weiss das es ziemlich Fanboyig klingt aber ich bin endlich an dem Punkt, wo ich mich einfach nur noch 100% komplett darüber freue das morgen der 2. März ist und das iPad 2 vorgestellt wird.

Bleiben nur noch 92384789324 Monate bis Apple das Teil dann auch wirklich auf den Markt wirft.

Andere Frage die ich mir stelle ist:

- lohnen sich die neuen Specs ??
Ich besitze ein iPhone und von daher ist der Drang mit dem iPad unbedingt ein Foto schiessen zu wollen eher gemässigt.

- hat man sogar einen preis/leistungs vorteil wenn man sich ein altes 1. Gen iPad kauft ?


Fragen über Fragen.
So. Ab Morgen gestalte ich diesen Blog mal richtig.

Take.

Montag, 21. Februar 2011

So i just came about this site buildlog.

The very cool thing about this site is that it made all my tinkering dreams come true.
I was thinking of building a reprap on das-labor.org 's cupcake cnc, but i thought that would be too easy so i wanted something better but didnt know what i should do.
So when i finally saw the possibility of the laser cutter i was mindblown.

The way I intend to build the "laser cutter" is this:

Its a 4 (!!! keep that in mind),
4-way Device

when im finished with it, it will:


- Laser cut
- 3D Print
- CNC
- CNC Scan


im going to put a blu-ray laser in it for the laser part.
reprap precision extruder, for the 3D Printer part.
a router(oberfräse) for the cnc.
and if you turn your head over to ... this Post ,

you can see that its not a matter of €€€ to create outstanding Projects in your home.

Donnerstag, 10. Februar 2011

upgrade...

im making get request like CUUUHRUUUHHHAAZZZZYYY !!!!

expect to be seeing the first eval. version e.g. alpha version of my new Arduino Software. Im currently at the state that im combining three layers off application control, i will implement access control, data logging und interactivity

and as you all know, this is only for the purpose of creating the interactive coffeetable im talkin about for the last 3 weeks.

ive gotta take a nap. gotta work morrow @ 11am :/

p33z 0ut.