1 18 package org.apache.batik.dom.svg; 19 20 import org.apache.batik.dom.AbstractDocument; 21 import org.w3c.dom.Node ; 22 import org.w3c.dom.svg.SVGAnimatedNumber; 23 import org.w3c.dom.svg.SVGPathElement; 24 import org.w3c.dom.svg.SVGPathSeg; 25 import org.w3c.dom.svg.SVGPathSegArcAbs; 26 import org.w3c.dom.svg.SVGPathSegArcRel; 27 import org.w3c.dom.svg.SVGPathSegClosePath; 28 import org.w3c.dom.svg.SVGPathSegCurvetoCubicAbs; 29 import org.w3c.dom.svg.SVGPathSegCurvetoCubicRel; 30 import org.w3c.dom.svg.SVGPathSegCurvetoCubicSmoothAbs; 31 import org.w3c.dom.svg.SVGPathSegCurvetoCubicSmoothRel; 32 import org.w3c.dom.svg.SVGPathSegCurvetoQuadraticAbs; 33 import org.w3c.dom.svg.SVGPathSegCurvetoQuadraticRel; 34 import org.w3c.dom.svg.SVGPathSegCurvetoQuadraticSmoothAbs; 35 import org.w3c.dom.svg.SVGPathSegCurvetoQuadraticSmoothRel; 36 import org.w3c.dom.svg.SVGPathSegLinetoAbs; 37 import org.w3c.dom.svg.SVGPathSegLinetoHorizontalAbs; 38 import org.w3c.dom.svg.SVGPathSegLinetoHorizontalRel; 39 import org.w3c.dom.svg.SVGPathSegLinetoRel; 40 import org.w3c.dom.svg.SVGPathSegLinetoVerticalAbs; 41 import org.w3c.dom.svg.SVGPathSegLinetoVerticalRel; 42 import org.w3c.dom.svg.SVGPathSegList; 43 import org.w3c.dom.svg.SVGPathSegMovetoAbs; 44 import org.w3c.dom.svg.SVGPathSegMovetoRel; 45 import org.w3c.dom.svg.SVGPoint; 46 47 53 public class SVGOMPathElement 54 extends SVGGraphicsElement 55 implements SVGPathElement, 56 SVGPathSegConstants { 57 58 61 protected SVGOMPathElement() { 62 } 63 64 69 public SVGOMPathElement(String prefix, AbstractDocument owner) { 70 super(prefix, owner); 71 } 72 73 76 public String getLocalName() { 77 return "path"; 78 } 79 80 83 public SVGAnimatedNumber getPathLength() { 84 throw new RuntimeException (" !!! getPathLength() Not Yet Implemented"); 85 } 86 87 90 public float getTotalLength() { 91 return SVGPathSupport.getTotalLength(this); 92 } 93 94 97 public SVGPoint getPointAtLength(float distance) { 98 return SVGPathSupport.getPointAtLength(this, distance); 99 } 100 101 104 public int getPathSegAtLength(float distance) { 105 throw new RuntimeException 106 (" !!! getPathSegAtLength() Not Yet Implemented"); 107 } 108 109 112 public SVGPathSegList getPathSegList() { 113 return SVGAnimatedPathDataSupport.getPathSegList(this); 114 } 115 116 119 public SVGPathSegList getNormalizedPathSegList() { 120 return SVGAnimatedPathDataSupport.getNormalizedPathSegList(this); 121 } 122 123 126 public SVGPathSegList getAnimatedPathSegList() { 127 return SVGAnimatedPathDataSupport.getAnimatedNormalizedPathSegList(this); 128 } 129 130 133 public SVGPathSegList getAnimatedNormalizedPathSegList() { 134 return SVGAnimatedPathDataSupport.getAnimatedNormalizedPathSegList 135 (this); 136 } 137 138 140 143 public SVGPathSegClosePath createSVGPathSegClosePath() { 144 return new SVGPathSegClosePath(){ 145 public short getPathSegType(){ 146 return SVGPathSeg.PATHSEG_CLOSEPATH; 147 } 148 public String getPathSegTypeAsLetter(){ 149 return PATHSEG_CLOSEPATH_LETTER; 150 } 151 }; 152 } 153 154 158 public SVGPathSegMovetoAbs createSVGPathSegMovetoAbs(final float x_value, final float y_value) { 159 return new SVGPathSegMovetoAbs(){ 161 protected float x = x_value; 162 protected float y = y_value; 163 164 public short getPathSegType(){ 165 return SVGPathSeg.PATHSEG_MOVETO_ABS; 166 } 167 public String getPathSegTypeAsLetter(){ 168 return PATHSEG_MOVETO_ABS_LETTER; 169 } 170 public float getX(){ 171 return x; 172 } 173 public void setX(float x){ 174 this.x = x; 175 } 176 public float getY(){ 177 return y; 178 } 179 public void setY(float y){ 180 this.y = y; 181 } 182 }; 183 } 184 185 189 public SVGPathSegMovetoRel createSVGPathSegMovetoRel(final float x_value, final float y_value) { 190 return new SVGPathSegMovetoRel(){ 192 protected float x = x_value; 193 protected float y = y_value; 194 195 public short getPathSegType(){ 196 return SVGPathSeg.PATHSEG_MOVETO_REL; 197 } 198 public String getPathSegTypeAsLetter(){ 199 return PATHSEG_MOVETO_REL_LETTER; 200 } 201 public float getX(){ 202 return x; 203 } 204 public void setX(float x){ 205 this.x = x; 206 } 207 public float getY(){ 208 return y; 209 } 210 public void setY(float y){ 211 this.y = y; 212 } 213 }; 214 215 } 216 217 221 public SVGPathSegLinetoAbs createSVGPathSegLinetoAbs(final float x_value, final float y_value) { 222 return new SVGPathSegLinetoAbs(){ 224 protected float x = x_value; 225 protected float y = y_value; 226 227 public short getPathSegType(){ 228 return SVGPathSeg.PATHSEG_LINETO_ABS; 229 } 230 public String getPathSegTypeAsLetter(){ 231 return PATHSEG_LINETO_ABS_LETTER; 232 } 233 public float getX(){ 234 return x; 235 } 236 public void setX(float x){ 237 this.x = x; 238 } 239 public float getY(){ 240 return y; 241 } 242 public void setY(float y){ 243 this.y = y; 244 } 245 }; 246 } 247 248 252 public SVGPathSegLinetoRel createSVGPathSegLinetoRel(final float x_value, final float y_value) { 253 return new SVGPathSegLinetoRel(){ 255 protected float x = x_value; 256 protected float y = y_value; 257 258 public short getPathSegType(){ 259 return SVGPathSeg.PATHSEG_LINETO_REL; 260 } 261 public String getPathSegTypeAsLetter(){ 262 return PATHSEG_LINETO_REL_LETTER; 263 } 264 public float getX(){ 265 return x; 266 } 267 public void setX(float x){ 268 this.x = x; 269 } 270 public float getY(){ 271 return y; 272 } 273 public void setY(float y){ 274 this.y = y; 275 } 276 }; 277 } 278 279 283 public SVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs(final float x_value) { 284 return new SVGPathSegLinetoHorizontalAbs(){ 286 protected float x = x_value; 287 288 public short getPathSegType(){ 289 return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS; 290 } 291 public String getPathSegTypeAsLetter(){ 292 return PATHSEG_LINETO_HORIZONTAL_ABS_LETTER; 293 } 294 public float getX(){ 295 return x; 296 } 297 public void setX(float x){ 298 this.x = x; 299 } 300 }; 301 302 } 303 304 308 public SVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel(final float x_value) { 309 return new SVGPathSegLinetoHorizontalRel(){ 311 protected float x = x_value; 312 313 public short getPathSegType(){ 314 return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL; 315 } 316 public String getPathSegTypeAsLetter(){ 317 return PATHSEG_LINETO_HORIZONTAL_REL_LETTER; 318 } 319 public float getX(){ 320 return x; 321 } 322 public void setX(float x){ 323 this.x = x; 324 } 325 }; 326 327 } 328 329 333 public SVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs(final float y_value) { 334 return new SVGPathSegLinetoVerticalAbs(){ 336 protected float y = y_value; 337 338 public short getPathSegType(){ 339 return SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS; 340 } 341 public String getPathSegTypeAsLetter(){ 342 return PATHSEG_LINETO_VERTICAL_ABS_LETTER; 343 } 344 public float getY(){ 345 return y; 346 } 347 public void setY(float y){ 348 this.y = y; 349 } 350 }; 351 352 } 353 354 358 public SVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel(final float y_value) { 359 return new SVGPathSegLinetoVerticalRel(){ 361 protected float y = y_value; 362 363 public short getPathSegType(){ 364 return SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL; 365 } 366 public String getPathSegTypeAsLetter(){ 367 return PATHSEG_LINETO_VERTICAL_REL_LETTER; 368 } 369 public float getY(){ 370 return y; 371 } 372 public void setY(float y){ 373 this.y = y; 374 } 375 }; 376 377 } 378 379 383 public SVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs 384 (final float x_value, final float y_value, 385 final float x1_value, final float y1_value, 386 final float x2_value, final float y2_value) { 387 return new SVGPathSegCurvetoCubicAbs(){ 389 protected float x = x_value; 390 protected float y = y_value; 391 protected float x1 = x1_value; 392 protected float y1 = y1_value; 393 protected float x2 = x2_value; 394 protected float y2 = y2_value; 395 396 public short getPathSegType(){ 397 return SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS; 398 } 399 public String getPathSegTypeAsLetter(){ 400 return PATHSEG_CURVETO_CUBIC_ABS_LETTER; 401 } 402 public float getX(){ 403 return x; 404 } 405 public void setX(float x){ 406 this.x = x; 407 } 408 public float getY(){ 409 return y; 410 } 411 public void setY(float y){ 412 this.y = y; 413 } 414 public float getX1(){ 415 return x1; 416 } 417 public void setX1(float x1){ 418 this.x1 = x1; 419 } 420 public float getY1(){ 421 return y1; 422 } 423 public void setY1(float y1){ 424 this.y1 = y1; 425 } 426 public float getX2(){ 427 return x2; 428 } 429 public void setX2(float x2){ 430 this.x2 = x2; 431 } 432 public float getY2(){ 433 return y2; 434 } 435 public void setY2(float y2){ 436 this.y2 = y2; 437 } 438 }; 439 440 } 441 442 446 public SVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel 447 (final float x_value, final float y_value, 448 final float x1_value, final float y1_value, 449 final float x2_value, final float y2_value) { 450 return new SVGPathSegCurvetoCubicRel(){ 452 protected float x = x_value; 453 protected float y = y_value; 454 protected float x1 = x1_value; 455 protected float y1 = y1_value; 456 protected float x2 = x2_value; 457 protected float y2 = y2_value; 458 459 public short getPathSegType(){ 460 return SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL; 461 } 462 public String getPathSegTypeAsLetter(){ 463 return PATHSEG_CURVETO_CUBIC_REL_LETTER; 464 } 465 public float getX(){ 466 return x; 467 } 468 public void setX(float x){ 469 this.x = x; 470 } 471 public float getY(){ 472 return y; 473 } 474 public void setY(float y){ 475 this.y = y; 476 } 477 public float getX1(){ 478 return x1; 479 } 480 public void setX1(float x1){ 481 this.x1 = x1; 482 } 483 public float getY1(){ 484 return y1; 485 } 486 public void setY1(float y1){ 487 this.y1 = y1; 488 } 489 public float getX2(){ 490 return x2; 491 } 492 public void setX2(float x2){ 493 this.x2 = x2; 494 } 495 public float getY2(){ 496 return y2; 497 } 498 public void setY2(float y2){ 499 this.y2 = y2; 500 } 501 }; 502 } 503 504 508 public SVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs 509 (final float x_value, final float y_value, 510 final float x1_value, final float y1_value) { 511 return new SVGPathSegCurvetoQuadraticAbs(){ 513 protected float x = x_value; 514 protected float y = y_value; 515 protected float x1 = x1_value; 516 protected float y1 = y1_value; 517 518 public short getPathSegType(){ 519 return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS; 520 } 521 public String getPathSegTypeAsLetter(){ 522 return PATHSEG_CURVETO_QUADRATIC_ABS_LETTER; 523 } 524 public float getX(){ 525 return x; 526 } 527 public void setX(float x){ 528 this.x = x; 529 } 530 public float getY(){ 531 return y; 532 } 533 public void setY(float y){ 534 this.y = y; 535 } 536 public float getX1(){ 537 return x1; 538 } 539 public void setX1(float x1){ 540 this.x1 = x1; 541 } 542 public float getY1(){ 543 return y1; 544 } 545 public void setY1(float y1){ 546 this.y1 = y1; 547 } 548 }; 549 } 550 551 555 public SVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel 556 (final float x_value, final float y_value, 557 final float x1_value, final float y1_value) { 558 return new SVGPathSegCurvetoQuadraticRel(){ 560 protected float x = x_value; 561 protected float y = y_value; 562 protected float x1 = x1_value; 563 protected float y1 = y1_value; 564 565 public short getPathSegType(){ 566 return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL; 567 } 568 public String getPathSegTypeAsLetter(){ 569 return PATHSEG_CURVETO_QUADRATIC_REL_LETTER; 570 } 571 public float getX(){ 572 return x; 573 } 574 public void setX(float x){ 575 this.x = x; 576 } 577 public float getY(){ 578 return y; 579 } 580 public void setY(float y){ 581 this.y = y; 582 } 583 public float getX1(){ 584 return x1; 585 } 586 public void setX1(float x1){ 587 this.x1 = x1; 588 } 589 public float getY1(){ 590 return y1; 591 } 592 public void setY1(float y1){ 593 this.y1 = y1; 594 } 595 }; 596 } 597 598 602 public SVGPathSegCurvetoCubicSmoothAbs 603 createSVGPathSegCurvetoCubicSmoothAbs 604 (final float x_value, final float y_value, 605 final float x2_value, final float y2_value) { 606 return new SVGPathSegCurvetoCubicSmoothAbs(){ 608 protected float x = x_value; 609 protected float y = y_value; 610 protected float x2 = x2_value; 611 protected float y2 = y2_value; 612 613 public short getPathSegType(){ 614 return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; 615 } 616 public String getPathSegTypeAsLetter(){ 617 return PATHSEG_CURVETO_CUBIC_SMOOTH_ABS_LETTER; 618 } 619 public float getX(){ 620 return x; 621 } 622 public void setX(float x){ 623 this.x = x; 624 } 625 public float getY(){ 626 return y; 627 } 628 public void setY(float y){ 629 this.y = y; 630 } 631 public float getX2(){ 632 return x2; 633 } 634 public void setX2(float x2){ 635 this.x2 = x2; 636 } 637 public float getY2(){ 638 return y2; 639 } 640 public void setY2(float y2){ 641 this.y2 = y2; 642 } 643 }; 644 } 645 646 650 public SVGPathSegCurvetoCubicSmoothRel 651 createSVGPathSegCurvetoCubicSmoothRel 652 (final float x_value, final float y_value, 653 final float x2_value, final float y2_value) { 654 return new SVGPathSegCurvetoCubicSmoothRel(){ 656 protected float x = x_value; 657 protected float y = y_value; 658 protected float x2 = x2_value; 659 protected float y2 = y2_value; 660 661 public short getPathSegType(){ 662 return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL; 663 } 664 public String getPathSegTypeAsLetter(){ 665 return PATHSEG_CURVETO_CUBIC_SMOOTH_REL_LETTER; 666 } 667 public float getX(){ 668 return x; 669 } 670 public void setX(float x){ 671 this.x = x; 672 } 673 public float getY(){ 674 return y; 675 } 676 public void setY(float y){ 677 this.y = y; 678 } 679 public float getX2(){ 680 return x2; 681 } 682 public void setX2(float x2){ 683 this.x2 = x2; 684 } 685 public float getY2(){ 686 return y2; 687 } 688 public void setY2(float y2){ 689 this.y2 = y2; 690 } 691 }; 692 } 693 694 698 public SVGPathSegCurvetoQuadraticSmoothAbs 699 createSVGPathSegCurvetoQuadraticSmoothAbs 700 (final float x_value, final float y_value) { 701 return new SVGPathSegCurvetoQuadraticSmoothAbs(){ 703 protected float x = x_value; 704 protected float y = y_value; 705 706 public short getPathSegType(){ 707 return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS; 708 } 709 public String getPathSegTypeAsLetter(){ 710 return PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS_LETTER; 711 } 712 public float getX(){ 713 return x; 714 } 715 public void setX(float x){ 716 this.x = x; 717 } 718 public float getY(){ 719 return y; 720 } 721 public void setY(float y){ 722 this.y = y; 723 } 724 }; 725 726 } 727 728 732 public SVGPathSegCurvetoQuadraticSmoothRel 733 createSVGPathSegCurvetoQuadraticSmoothRel 734 (final float x_value, final float y_value) { 735 return new SVGPathSegCurvetoQuadraticSmoothRel(){ 737 protected float x = x_value; 738 protected float y = y_value; 739 740 public short getPathSegType(){ 741 return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL; 742 } 743 public String getPathSegTypeAsLetter(){ 744 return PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL_LETTER; 745 } 746 public float getX(){ 747 return x; 748 } 749 public void setX(float x){ 750 this.x = x; 751 } 752 public float getY(){ 753 return y; 754 } 755 public void setY(float y){ 756 this.y = y; 757 } 758 }; 759 } 760 761 765 public SVGPathSegArcAbs createSVGPathSegArcAbs 766 (final float x_value, final float y_value, 767 final float r1_value, final float r2_value, 768 final float angle_value, 769 final boolean largeArcFlag_value, 770 final boolean sweepFlag_value) { 771 return new SVGPathSegArcAbs(){ 773 protected float x = x_value; 774 protected float y = y_value; 775 protected float r1 = r1_value; 776 protected float r2 = r2_value; 777 protected float angle = angle_value; 778 protected boolean largeArcFlag = largeArcFlag_value; 779 protected boolean sweepFlag = sweepFlag_value; 780 781 public short getPathSegType(){ 782 return SVGPathSeg.PATHSEG_ARC_ABS; 783 } 784 public String getPathSegTypeAsLetter(){ 785 return PATHSEG_ARC_ABS_LETTER; 786 } 787 public float getX(){ 788 return x; 789 } 790 public void setX(float x){ 791 this.x = x; 792 } 793 public float getY(){ 794 return y; 795 } 796 public void setY(float y){ 797 this.y = y; 798 } 799 public float getR1(){ 800 return r1; 801 } 802 public void setR1(float r1){ 803 this.r1 = r1; 804 } 805 public float getR2(){ 806 return r2; 807 } 808 public void setR2(float r2){ 809 this.r2 = r2; 810 } 811 public float getAngle(){ 812 return angle; 813 } 814 public void setAngle(float angle){ 815 this.angle = angle; 816 } 817 public boolean getLargeArcFlag(){ 818 return largeArcFlag; 819 } 820 public void setLargeArcFlag(boolean largeArcFlag){ 821 this.largeArcFlag = largeArcFlag; 822 } 823 public boolean getSweepFlag(){ 824 return sweepFlag; 825 } 826 public void setSweepFlag(boolean sweepFlag){ 827 this.sweepFlag = sweepFlag; 828 } 829 830 831 }; 832 } 833 834 838 public SVGPathSegArcRel createSVGPathSegArcRel 839 (final float x_value, final float y_value, 840 final float r1_value, final float r2_value, 841 final float angle_value, 842 final boolean largeArcFlag_value, 843 final boolean sweepFlag_value) { 844 return new SVGPathSegArcRel(){ 846 protected float x = x_value; 847 protected float y = y_value; 848 protected float r1 = r1_value; 849 protected float r2 = r2_value; 850 protected float angle = angle_value; 851 protected boolean largeArcFlag = largeArcFlag_value; 852 protected boolean sweepFlag = sweepFlag_value; 853 854 public short getPathSegType(){ 855 return SVGPathSeg.PATHSEG_ARC_REL; 856 } 857 public String getPathSegTypeAsLetter(){ 858 return PATHSEG_ARC_REL_LETTER; 859 } 860 public float getX(){ 861 return x; 862 } 863 public void setX(float x){ 864 this.x = x; 865 } 866 public float getY(){ 867 return y; 868 } 869 public void setY(float y){ 870 this.y = y; 871 } 872 public float getR1(){ 873 return r1; 874 } 875 public void setR1(float r1){ 876 this.r1 = r1; 877 } 878 public float getR2(){ 879 return r2; 880 } 881 public void setR2(float r2){ 882 this.r2 = r2; 883 } 884 public float getAngle(){ 885 return angle; 886 } 887 public void setAngle(float angle){ 888 this.angle = angle; 889 } 890 public boolean getLargeArcFlag(){ 891 return largeArcFlag; 892 } 893 public void setLargeArcFlag(boolean largeArcFlag){ 894 this.largeArcFlag = largeArcFlag; 895 } 896 public boolean getSweepFlag(){ 897 return sweepFlag; 898 } 899 public void setSweepFlag(boolean sweepFlag){ 900 this.sweepFlag = sweepFlag; 901 } 902 903 904 }; 905 } 906 907 910 protected Node newNode() { 911 return new SVGOMPathElement(); 912 } 913 } 914 | Popular Tags |