wang
05-11-2004, 05:06 PM
I am a college student of Wuhan University, P.R.China. My specialty in school is GIS. Now I am learning cartography ,using the SVG method. I have viewed the website "learn SVG" and have seen some examples provided by you . I think your examples are very helpful to my study!
Recently, I met an intractable problem. If you can help me , even a few of pieces of suggestion,I will be very appreciated to your kindness!
I designed the map symbol, which required that the symbol unit should be distributed randomly in the whole area. According to the way which used in the "pattern" design,I can hardly make the sign unit distribute randomly,then I decided to use the "javascript" computer language to do so. But, still, I can't combine the javascript language with the SVG file rightly.
Here are some codes, which are created by myself.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN"
"http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd">
<svg width="16cm" height="16cm">
<desc>密集灌木林填充模板</desc>
<defs>
<symbol id="mjgc" style="fill:none;stroke:black;stroke-width:0.5">
<circle cx="50" cy="50" r="6"/>
<g transform="translate(0,-14)">
<circle cx="50" cy="50" r="2" style="fill:black"/>
</g>
<g transform="translate(0,-22)">
<circle cx="50" cy="50" r="2" style="fill:black"/>
</g>
<g transform="translate(-10.392,6)">
<circle cx="50" cy="50" r="2" style="fill:black"/>
</g>
<g transform="translate(10.392,6)">
<circle cx="50" cy="50" r="2" style="fill:black"/>
</g>
</symbol>
//here I define the symbol unit
<pattern id="moban008" patternUnits="userSpaceOnUse"
x="0" y="0" width="14cm" height="4cm" viewBox="0 0 1400 400">
<use xlink:href="#mjgc" transform="translate(200 60) rotate(-90 50 50 ) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(650 60) rotate(225 50 50 ) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(1150 0) rotate(45 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(70 170) rotate(165 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(400 170) rotate(265 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(900 120) rotate(120 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(1250 150) rotate(300 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(200 280) rotate(320 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(630 280) rotate(320 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(1150 250) rotate(90 50 50) scale(1.5)"/>
</pattern>
<rect id="waikuang" style="stroke:black;stroke-width:0.05cm;stroke-dasharray:2 8"
x="0.5cm" y="0.3cm" width="14cm" height="15.7cm"/>
</defs>
<use xlink:href="#waikuang" style="fill:rgb(152 251 152);fill-opacity:0.3"/>
<use xlink:href="#waikuang" style="fill:url(#moban008)"/>
</svg>
As you can see in the ".svg" form, I can't make the map symbol unit distribute randomly. Their locations and rotate angles are defined by me, in the form of
transform="translate(200 60) rotate(-90 50 50 ) scale(1.5)"
best wish! Thank you!
Recently, I met an intractable problem. If you can help me , even a few of pieces of suggestion,I will be very appreciated to your kindness!
I designed the map symbol, which required that the symbol unit should be distributed randomly in the whole area. According to the way which used in the "pattern" design,I can hardly make the sign unit distribute randomly,then I decided to use the "javascript" computer language to do so. But, still, I can't combine the javascript language with the SVG file rightly.
Here are some codes, which are created by myself.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN"
"http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd">
<svg width="16cm" height="16cm">
<desc>密集灌木林填充模板</desc>
<defs>
<symbol id="mjgc" style="fill:none;stroke:black;stroke-width:0.5">
<circle cx="50" cy="50" r="6"/>
<g transform="translate(0,-14)">
<circle cx="50" cy="50" r="2" style="fill:black"/>
</g>
<g transform="translate(0,-22)">
<circle cx="50" cy="50" r="2" style="fill:black"/>
</g>
<g transform="translate(-10.392,6)">
<circle cx="50" cy="50" r="2" style="fill:black"/>
</g>
<g transform="translate(10.392,6)">
<circle cx="50" cy="50" r="2" style="fill:black"/>
</g>
</symbol>
//here I define the symbol unit
<pattern id="moban008" patternUnits="userSpaceOnUse"
x="0" y="0" width="14cm" height="4cm" viewBox="0 0 1400 400">
<use xlink:href="#mjgc" transform="translate(200 60) rotate(-90 50 50 ) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(650 60) rotate(225 50 50 ) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(1150 0) rotate(45 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(70 170) rotate(165 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(400 170) rotate(265 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(900 120) rotate(120 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(1250 150) rotate(300 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(200 280) rotate(320 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(630 280) rotate(320 50 50) scale(1.5)"/>
<use xlink:href="#mjgc" transform="translate(1150 250) rotate(90 50 50) scale(1.5)"/>
</pattern>
<rect id="waikuang" style="stroke:black;stroke-width:0.05cm;stroke-dasharray:2 8"
x="0.5cm" y="0.3cm" width="14cm" height="15.7cm"/>
</defs>
<use xlink:href="#waikuang" style="fill:rgb(152 251 152);fill-opacity:0.3"/>
<use xlink:href="#waikuang" style="fill:url(#moban008)"/>
</svg>
As you can see in the ".svg" form, I can't make the map symbol unit distribute randomly. Their locations and rotate angles are defined by me, in the form of
transform="translate(200 60) rotate(-90 50 50 ) scale(1.5)"
best wish! Thank you!