[mapguide-users] How to prepare unmanaged DWF Drawingsource?
Brad L
bradl at mai-eng.com
Wed Oct 24 17:52:20 EDT 2007
I use the file system to get the name of the folder in the unzipped dwf. The
folder name is the same as the sheet attribute you need.
here is a function in VB to get the Name of the folder. It should be easy
to convert to C# or just drop it in your appcode folder as VB code.
Public Function get_sheet(ByVal resourceName As String) As String
Dim folderlocation As String =
ConfigurationManager.AppSettings("dwfpath") & resourceName & "\"
Dim dirinfo As DirectoryInfo
Dim myName As String = ""
For Each dir As String In Directory.GetDirectories(folderlocation)
dirinfo = New DirectoryInfo(dir)
myName = dirinfo.Name
Next
Return myName
End Function
After you have the sheet name you use DOM to replace it in the drawingsource
and layersource template files or just build the XML document in memory.
Then you can add these to your repository.
There are 1000 ways to skin this cat. You could find a second party .Net
class that works with zip files or use the windows API to work with them or
take the easy way out as I did and unzip them all to a second directory and
work with it that way. Whatever route you choose the information you need
is contained inside the dwf and the dwf is just a zip file (replace .dwf
with .zip and have a look).
Brad Leighninger
Mathews & Associates, Inc
417-869-6009
Carl wrote:
>
> Thank you very much.
>
> It's ok to left the 0 to range coordinates(miin/max Values).
>
> Could you please tell me how do you extract the sheet name by program
> automatically, for example in c#, but not mannaully.
>
> Could somebody post an example to demo the process to get the coordinates
> of sheet ranges?
>
>
>
>
> Brad L wrote:
>>
>> I am using unmanaged DWF files but I build all of my maps dynamically at
>> runtime. I don't know if this makes things more or less difficult for
>> your situation but I will give you the short version of my process.
>>
>> The XML for your dwf layer will look something like this.
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <DrawingSource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xsi:noNamespaceSchemaLocation="DrawingSource-1.0.0.xsd">
>> <SourceName>C:\Pathtodwfonserver\mydwf.dwf</SourceName>
>> <CoordinateSpace>LOCAL_CS["Non-Earth (IInch)",LOCAL_DATUM["Local
>> Datum",0],UNIT["IInch",
>> 0.0254],AXIS["X",EAST],AXIS["Y",NORTH]]</CoordinateSpace>
>> <Sheet>
>> <Name>com.autodesk.dwf.ePlot_94A374353C9B4FBB02843AF1AC24E437</Name>
>> <Extent>
>> <MinX>0</MinX>
>> <MinY>0</MinY>
>> <MaxX>0</MaxX>
>> <MaxY>0</MaxY>
>> </Extent>
>> </Sheet>
>> </DrawingSource>
>>
>> Put in the physical path to your unmanaged dwf as the SourceName, change
>> your coordinate space to the correct system, and put in the coordinates
>> (I have left them all at 0 and it seems to work). The Sheet->Name comes
>> from the dwf itself. If you unzip the dwf you will see this info as the
>> folder name and in the xml files. You can also get the template for this
>> by saving the managed dwf as XML.
>>
>> The Layer XML for this dwf would look like this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:noNamespaceSchemaLocation="LayerDefinition-1.1.0.xsd"
>> version="1.1.0">
>> <DrawingLayerDefinition>
>> <ResourceId>Session:SessionID//mydwf.DrawingSource</ResourceId>
>> <Sheet>com.autodesk.dwf.ePlot_94A374353C9B4FBB02843AF1AC24E437</Sheet>
>> </DrawingLayerDefinition>
>> </LayerDefinition>
>>
>> Where the ResourceID references the above drawingsource and the sheet is
>> the same as the Sheet->Name above.
>>
>> As I said, I add these resources to the session repository at run time
>> but you should be able to save these resources to the library as well.
>>
>> Hope that helps
>>
>> Brad Leighninger
>> Mathews & Associates, Inc
>> 417-869-6009
>>
>>
>> Carl wrote:
>>>
>>> Sorry, I haven't.
>>>
>>>
>>> btenbroeck wrote:
>>>>
>>>> Carl, did you ever find/get a solution to this?
>>>>
>>>>
>>>> Carl wrote:
>>>>>
>>>>> It is ok to publish the unmanaged SDF file. but how to prepare
>>>>> unmanaged DWF Drawingsource? It seems more complicated than SDF.
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/How-to-prepare-unmanaged-DWF-Drawingsource--tf4529186s16610.html#a13395984
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list