I would like to use YCAD to only display maps. I tried using the YcadvPane and it displays the maps real great. but the tool bar always come along.. I would like to use some functionality provided in the tool bar (ie. zoom, span left , right ) but I would like to do it via my own interface is there anyway to do that.
I would really appreciate your response. Please mail me at email@example.com if there is any solution. Thanks in advance
[copy of offline reply]
This is Ed Karlo, developer of the Ycad library.
I'm impressed that you were able to make use of the YcadvPane module. The YcadvPane and all of the *lib.java and *BeanInfo.java classes were an unfinished attempt to create JavaBeans suitable for use in a drag-and-drop IDE. I had some moderate success but never figured out a good way to get the input beans connected to the viewer pane in a good way. I worked on the JavaBeans for awhile and then moved to other things.
There is a parameter to control the toolbar - "toolbar=false".
I call the existing toolbar the "default simple toolbar". I intended to make the toolbar "pluggable" but there is no code right now to handle this. You can turn the toolbar off (as above) and write toolbar code "outside" of the viewer. The YxxfDrwViewHander module is the master controller for the viewer. It listens for events from the toolbar to control the view and listens for events from the drawing. The view handler controls all views and will return the view Panel reference "getViewer()" for developer use. The view handler has methods (used by the toolbar) to change the drawing view. See the view handler methods that start with "commandViewHandler_toolbar_". These methods are the same ones used by the toolbar. You can call them from your own custom toolbar. The view handler is the "vhandler" reference in YcadvPane.
I recently did a project that used the Ycad viewer as a component in a larger Swing app. I did not use the YcadvPane module but instead duplicated the code in Ycadv. Your solution to use the YcadvPane is a good one. I considered using it but did not.
Also, I hope to have a new release out in the next 2-3 weeks. The most significant change is the addition of a Swing version of the viewer. The AWT version (the YxxfDrw*) modules are getting a bit long in the tooth. The new Swing version (the YxxfJDrw*) modules make use of Swing features like double buffering. The "YxxfPrt*" modules allow rendering the drawing to an arbitrary Graphics object.
Other changes include:
- Initial implementation of the MTEXT entity.
- Implementation of the ELLIPSE entity.
- Major improvements to the display of Paper Space views. The toolbar functions (zoom, pan, etc.) now work in paper space.
The new Swing viewer is called "YcadvJ". The code is currently in CVS on sourceforge. It is still under development but it is working well enough to use. You can check the latest version out of the CVS repository. To continue your YcadvPane usage one could create a new module called YcadvJPane.
If you make any changes to the Ycad code you can send them to me and I will incorporate them into the code base.
Let me know if this helps.
I decided to change my approach and use the code in the file YCAD_api_readme1_a.txt to draw the BufferedImage object which I used to draw the map instead.
However, I found one problem that maybe need your assistance. My Dxf file is quite big and when I display it on a Panel it display only part of the map.. so I tried to adjust the width and height parameter; however, adjusting that only makes the maps bigger but still display only the same part of the map ( the result is like I use zoom in function)
Is there anyway I can increase the boundary of my display to cover the whole map file??
Forgot to tell you I'm using this method createEffect_ycadv1(String ycadv1PropertiesString, int img_width, int img_height)
Not sure what may be wrong without seeing it but one thing to consider is that the drawing view is rendered as it was last saved by the program that created the dxf file. This is done by values in the viewport entities (paper space view) or the vport table entries (model space views) in the drawing file.
If this is indeed the problem you might try loading your drawing into a CAD program, orient the map as desired and then save the modified dxf file.
Another thing you can do is call the commandViewHandler_toolbar_zoom_to_calc_extents() method before rendering the drawing to the BufferedImage. This will determine the full extents of the drawing and then zooms to those extents.
Have you looked at the drawing with the Ycadv viewer and if so what does it look like?
If your want to send me a sample drawing I can look at it and see if there is any problem.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.