Introduction
- What you will learn :
- You will learn in this tutorial how to build a module and plug it in your favorite GIS application.
- What you will need :
- A medium level in Java development
- NetBeans 6
- Puzzle Application
- Any Operating System
We assume in this tutorials you are familiar with Java langage and NetBeans IDE or equivalant (IntelliJ, Jbuilder, Eclipse ...)
1- Setting up the environment
1.1 Installing NetBeans
NetBeans 6 can be found here : download.netbeans.org
Be sure to have a JDK 1.5 or above installed, if not you can found one here : java.sun.com
You must install the JDK before NetBeans.
1.2 Installing Puzzle-GIS
There are still no official release of Puzzle but you can use a snapshot version.
you can found thoses here : Snapshot repository
Fortunatly Puzzle doesn't need any installation, just unzip the application somewhere.
1.3 Adding our platform
Now Start Netbeans, and go in the menus :
- Tools
- NetBeans Platforms
![]()
On this panel, click on Add Platform... and use the explore to add the previously unzipped Puzzle application.
You should see something like : "Puzzle-GIS XXXXXXXX" added in the list
You can now close the frame.
2- Creating our module
Here we really begin using Puzzle.
First create a new module project :
![]()
Fill everything as you wish expect the StandaloneModule and the platform :
![]()
When you are done, you should see the fallowing :
![]()
3- Adding a ToolBar Item
Lets add a ToolBar item to show a message with the active MapContext (the context with a green icon in the tree, there can be only one and always one).
3.1 Creating the ToolBar Item
Right click on the tutorial package node and New > Action
If you dont see Action go to the bottom item Other and you will find the Action menu in the list.
Select : Always Enabled
On the next page select :
category : Puzzle
Uncheck Global Menu Item
Check Global ToolBar Item and Toolbar context, any position will work (position is the place in the toolbar)
Fill the next pane like on the picture :
![]()
Here are the icons (right click > save as):
3.2 Setting the action
Until now we were only using NetBeans platform technology. To know which mapcontext is active we'll need to grab information for puzzle modules (Puzzle is a also a module, just like yours).
To indicate we need to specify a link to puzzle module, imagine it's a kind of classpath.
Right click on your module root node and go in properties and libraries
Add the Puzzle-Core and GeoTools references :
![]()
3.3 A bit of code
Ha! Java Code finaly ! From the beginning of the tutorial you haven't typed a single java code line, I now you're frustrated. So here is a few lines you will happily type on your keyboard.
Go in the ContextInfoAction class and complete the code :
I know that's not much but you won't have more in this first tutorial.
Please wait for the next tutorial to start real hack in Puzzle GIS.
4- Testing our module
Let's see what we made so far.
just hit the Run button (Green arrow in the toolbar)
And the result :
![]()
5- Building and importing our module in Puzzle
Nearly the end.
One single thing missing : building our module and share it with the world.
Building our module
Righ click on the root node of the module project : Create NBM
Wasn't that Easy ?
The result NBM (NetBeans Module) can be found in the build folder of the project with a name ending in .nbm like : org-puzzle-tutorial1.nbm
Importing our module in any Puzzle Application
And last step, importing the module in Puzzle.
- Start Puzzle
- Go in menus : Tools > Plugins and tab downloaded
- Click Add and use the explorer to grab the previous NBM we created.
That's all folks ![]()
1 Comment
Hide/Show CommentsJun 01, 2011
Katrina Trevino
Some specialists tell that <a href="http://bestfinance-blog.com/topics/business-loans">business loans</a> aid people to live the way they want, because they are able to feel free to buy needed things. Moreover, banks give short term loan for different classes of people.