Community
DWF
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add properties to WT_Polygon Object ?

3 REPLIES 3
Reply
Message 1 of 4
tragavendraraj
396 Views, 3 Replies

How to add properties to WT_Polygon Object ?

Hi All,

I want to add properties to the WT_Polygon object.
Please help me in this.

Thanks in advance.

Regards
Raga
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: tragavendraraj

Are you using the DWF toolkit? Check out the various samples therein. We
worked hard to provide good examples of many facets of publishing DWF data.
There are publishing samples in the toolkit which show how objects are
created and how properties are associated with objects. Good luck.

--
Jeffrey Klug
Sr. Software Engineer
Extended Design Group
Autodesk, Inc.


wrote in message news:5778289@discussion.autodesk.com...
Hi All,

I want to add properties to the WT_Polygon object.
Please help me in this.

Thanks in advance.

Regards
Raga
Message 3 of 4

Hi Jeffery,

Thanks for your reply.

The DWF Toolkit publishing samples are using DWFFile class. But I am using WT_File class. Using the WT_Polygon class am creating the polygon objects in the DWF file.
Also there are many layers in the file.
Please check the below code and suggest me how to add properties to the object if I use the WT_File and WT_Polygon classes for creating the Polygon objects.

CODE:
--------

int i=0;
int j=0;
int k=0;
int x=0;
int y=0;
char layerName[20];
WT_File whip_file;
WT_Logical_Point rect[5];
WT_Layer current_layer;
// WT_Polygon rect_polygon;
//WT_Polyline dml;
WT_Color previous_color;
try
{
//Set the filename and open mode.
whip_file.set_filename ("mines.dwf");
whip_file.set_file_mode (WT_File::File_Write);
//Set a different target version here if you don't want the current file version... for example:
//whip_file.heuristics().set_target_version(42); //produce a DWF ver 00.42

if (WT_Result::Success == whip_file.open())
{
//Set the binary data and compression settings.
//whip_file.heuristics().set_allow_binary_data(true);
//whip_file.heuristics().set_allow_data_compression(true);
//whip_file.desired_rendition().color() = WT_Color (255,0,0);

//Store the current layer.
current_layer = whip_file.desired_rendition().layer();



for(i=1;i<=layerCount;i++)
{
x=0;
y=0;

sprintf(layerName,"Layer %d",i);
whip_file.desired_rendition().layer() = WT_Layer(whip_file,i,layerName);
for(j=0;j<5;j++)
{
for(k=0;k<5;k++)
{
rect[0] = WT_Logical_Point(x,y);
rect[1] = WT_Logical_Point(x+10,y);
rect[2] = WT_Logical_Point(x+10,y+10);
rect[3] = WT_Logical_Point(x,y+10);
rect[4] = WT_Logical_Point(x,y);
//Create the polygon.
WT_Polygon rect_polygon(4, rect, WD_True); WT_Polyline dml(5, rect, WD_True);

//Serialize.
WD_CHECK(rect_polygon.serialize(whip_file));

previous_color = whip_file.desired_rendition().color();
whip_file.desired_rendition().color() = WT_Color (255,0,0);
WD_CHECK(dml.serialize(whip_file));
whip_file.desired_rendition().color() = previous_color;
y=y+10;
}
y=0;
x=x+10;
}
}
//Restore the saved layer.
whip_file.desired_rendition().layer() = current_layer;
whip_file.close();

Regards
Raga
Message 4 of 4
Anonymous
in reply to: tragavendraraj

Properties / meta-data are part of the DWF package format introduced in DWF
version 6. "Classic DWFs" or "W2D" resource streams do not contain
properties for graphic objects. You must create a DWF 6+ package using the
DWFFile / publishing classes in order to associate XML properties with
graphics. Hope that helps clear things up.

--
Jeffrey Klug
Sr. Software Engineer
Extended Design Group
Autodesk, Inc.


wrote in message news:5779289@discussion.autodesk.com...
Hi Jeffery,

Thanks for your reply.

The DWF Toolkit publishing samples are using DWFFile class. But I am using
WT_File class. Using the WT_Polygon class am creating the polygon objects in
the DWF file.
Also there are many layers in the file.
Please check the below code and suggest me how to add properties to the
object if I use the WT_File and WT_Polygon classes for creating the Polygon
objects.

CODE:
--------

int i=0;
int j=0;
int k=0;
int x=0;
int y=0;
char layerName[20];
WT_File whip_file;
WT_Logical_Point rect[5];
WT_Layer current_layer;
// WT_Polygon rect_polygon;
//WT_Polyline dml;
WT_Color previous_color;
try
{
//Set the filename and open mode.
whip_file.set_filename ("mines.dwf");
whip_file.set_file_mode (WT_File::File_Write);
//Set a different target version here if you don't want the current file
version... for example:
//whip_file.heuristics().set_target_version(42); //produce a DWF ver 00.42

if (WT_Result::Success == whip_file.open())
{
//Set the binary data and compression settings.
//whip_file.heuristics().set_allow_binary_data(true);
//whip_file.heuristics().set_allow_data_compression(true);
//whip_file.desired_rendition().color() = WT_Color (255,0,0);

//Store the current layer.
current_layer = whip_file.desired_rendition().layer();



for(i=1;i<=layerCount;i++)
{
x=0;
y=0;

sprintf(layerName,"Layer %d",i);
whip_file.desired_rendition().layer() = WT_Layer(whip_file,i,layerName);
for(j=0;j<5;j++)
{
for(k=0;k<5;k++)
{
rect[0] = WT_Logical_Point(x,y);
rect[1] = WT_Logical_Point(x+10,y);
rect[2] = WT_Logical_Point(x+10,y+10);
rect[3] = WT_Logical_Point(x,y+10);
rect[4] = WT_Logical_Point(x,y);
//Create the polygon.
WT_Polygon rect_polygon(4, rect, WD_True); WT_Polyline dml(5, rect,
WD_True);

//Serialize.
WD_CHECK(rect_polygon.serialize(whip_file));

previous_color = whip_file.desired_rendition().color();
whip_file.desired_rendition().color() = WT_Color (255,0,0);
WD_CHECK(dml.serialize(whip_file));
whip_file.desired_rendition().color() = previous_color;
y=y+10;
}
y=0;
x=x+10;
}
}
//Restore the saved layer.
whip_file.desired_rendition().layer() = current_layer;
whip_file.close();

Regards
Raga

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost

 

”Tips

 

”Services