VDX to Java

Started by Xoma, December 20, 2010, 11:33:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Xoma

Hello! Did any try to convert VDX visio file to java's graphics2d object?
I'm trying to draw vdx file in Java with graphics2d but it's so difficult to convert visio-params to java primitives. Can anybody help with this problem?

Xoma

Well, mb smb know, what means the params in the NURBS funstion?
For example:
<E Unit="NURBS" F="NURBS(0.65583332119234, 3, 0, 0, 0.23684210526316,1.3924700861307,0,1, 0.47270541745138,0.78200050915582,0,1, 0.81578947368421,-0.29977424166652,0,1)">NURBS(0.65583332119234, 3, 0, 0, 0.23684210526316,1.3924700861307,0,1, 0.47270541745138,0.78200050915582,0,1, 0.81578947368421,-0.29977424166652,0,1)</E>

I have moveTo point. It's the first point of spline. And how to calculate other points? If the second and the third points are:
0.23684210526316,1.3924700861307,0,1, 0.47270541745138,0.78200050915582,0,1,
How can i get real coordinates of them? Is they are adding to first point? Or I must apply only xForm transform (Scale/rotate)?

Can anybody help?

Visio Guy

Here are some links to the Visio SDK regarding nurbs:

NurbsTo element
NURBS ShapeSheet function

Hopefully these follow some standard way of defining nurbs, so that your translation will go easy. But I haven't researched nurbs very much myself, so I can't say.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Xoma

#3
Thanks for reply... I've just found out, that the params like
0.23684210526316,1.3924700861307,0,1, 0.47270541745138,0.78200050915582,0,1,
are the coordinates of knots in percents of height and width...  8)
Other - only parsing... Thanks for all =)

Visio Guy

I think the values can be in terms of width and height, or absolute in the shape's local cooridinates (inches). It depends on the type.

Here's more from the developer help:

NURBS Function

Returns a nonuniform rational B-spline (NURBS). This function is used in the E cell in the NURBSTo geometry rows.

Syntax

NURBS(knotLast, degree, xType, yType, x1, y1, knot1, weight1, ...)

Parameters


NameRequired/
Optional
Data TypeDescription
knotLast     Required String The last knot.
degree Required Numeric The spline's degree.
xType Required Numeric Specifies how to interpret the x input data. If xType is 0, all x input data is interpreted as a percentage of Width. If xType is 1, all x input data is interpreted as local coordinates.
yType Required Numeric Specifies how to interpret the y input data. If yType is 0, all y input data is interpreted as a percentage of Height. If yType is 1, all y input data is interpreted as local coordinates.
x1 Required String An x-coordinate.
y1 Required String A y-coordinate.
knot1 Required String A knot on the B-spline.
weight1 Required String A weight on the B-spline.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Xoma

Yes... I found just this manual. In my case it was in terms of width an height.
And where did you find this article?

Visio Guy

It's probably online somewhere on MSDN, but I use the help file that comes with the Visio SDK. Probably the only help file from Microsoft that I use regularly, it's great! It contains a ShapeSheet functions and automation reference all rolled into one.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

wapperdude

Here is the entry that VisioGuy was referring to, http://msdn.microsoft.com/en-us/library/aa224197(office.11).aspx. or http://msdn.microsoft.com/en-us/library/ff768992.aspx.

Then, here is listing of the cell definitions of the NURBS function:  http://msdn.microsoft.com/en-us/library/ms406628(office.12).aspx

Clearly, the all-in-one solution of the free, downloadable SDK, is easier.

HTH
Wapperdude
Visio 2019 Pro

Visio Guy

Yeah, the Visio SDK/Developer help file is super when you're offline too. The SDK also comes with code-sample library that is pretty cool.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Xoma

Hey... Thanks for all =) Some more time and i'll finish the web-service on Java for  parsing and drawing vdx-file in Java-primitives. 8)
Only one object left. Elliptical arc...
Does smb know, how to convert visio params of EllipticalArc (Begin, End,  and Control points) to standart params like the Center, radiuses and angles of the arc?