Drawing line using map coordinates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Atif

    Drawing line using map coordinates

    Hello all,
    In my html page I want to add an image say of 800x600. Now I want that
    when ever I am given two coordinates on this image say (x1, y1)=(50,
    100) and (x2, y2)=(200, 300), the java script code will trace these
    coordinates on the image and draw the line between these two points.
    Can anyone please help me in writing the javascript code of this
    problem?

    Thanks and Regards
    Atif
  • Michael Winter

    #2
    Re: Drawing line using map coordinates

    Atif wrote:[color=blue]
    > Hello all,
    > In my html page I want to add an image say of 800x600. Now I want that
    > when ever I am given two coordinates on this image say (x1, y1)=(50,
    > 100) and (x2, y2)=(200, 300), the java script code will trace these
    > coordinates on the image and draw the line between these two points.
    > Can anyone please help me in writing the javascript code of this
    > problem?[/color]

    As far as I know, JavaScript has no drawing capabilities. I would
    imagine that the only way you can accomplish this is using a Java
    applet, or some other multimedia object like Flash.

    Mike

    --
    Michael Winter
    M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

    Comment

    • Jim Ley

      #3
      Re: Drawing line using map coordinates

      On Wed, 24 Dec 2003 15:10:26 GMT, Michael Winter
      <M.Winter@bluey onder.co.invali d> wrote:
      [color=blue]
      >Atif wrote:[color=green]
      >> In my html page I want to add an image say of 800x600. Now I want that
      >> when ever I am given two coordinates on this image say (x1, y1)=(50,
      >> 100) and (x2, y2)=(200, 300), the java script code will trace these
      >> coordinates on the image and draw the line between these two points.
      >> Can anyone please help me in writing the javascript code of this
      >> problem?[/color]
      >
      >As far as I know, JavaScript has no drawing capabilities.[/color]

      it has no capability to do anything at really...

      but javascript in SVG, or Flash, or with VML or VRML or
      DirectAnimation all have great drawing abilities. I'd recommend SVG
      myself.

      Jim.
      --
      comp.lang.javas cript FAQ - http://jibbering.com/faq/

      Comment

      • Dr John Stockton

        #4
        Re: Drawing line using map coordinates

        JRS: In article <C%hGb.5326$Ce1 .45775041@news-text.cableinet. net>, seen
        in news:comp.lang. javascript, Michael Winter <M.Winter@bluey onder.co.inv
        alid> posted at Wed, 24 Dec 2003 15:10:26 :-[color=blue]
        >Atif wrote:[/color]
        [color=blue][color=green]
        >> In my html page I want to add an image say of 800x600. Now I want that
        >> when ever I am given two coordinates on this image say (x1, y1)=(50,
        >> 100) and (x2, y2)=(200, 300), the java script code will trace these
        >> coordinates on the image and draw the line between these two points.
        >> Can anyone please help me in writing the javascript code of this
        >> problem?[/color]
        >
        >As far as I know, JavaScript has no drawing capabilities. I would
        >imagine that the only way you can accomplish this is using a Java
        >applet, or some other multimedia object like Flash.[/color]

        As a Rather Desperate Move, is it possible to take a graphic of a line,
        say a black diagonal on a transparent 800*600 area, and scale & position
        it over the existing image? Such a line, in a suitable graphical
        format, should not need a large file. Several, of different sizes,
        would be needed in order that the line-width would not scale into
        invisibility.

        --
        © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
        <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
        <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
        <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

        Comment

        • HikksNotAtHome

          #5
          Re: Drawing line using map coordinates

          In article <PH5PNwFmjf6$Ew EG@merlyn.demon .co.uk>, Dr John Stockton
          <spam@merlyn.de mon.co.uk> writes:
          [color=blue]
          >JRS: In article <C%hGb.5326$Ce1 .45775041@news-text.cableinet. net>, seen
          >in news:comp.lang. javascript, Michael Winter <M.Winter@bluey onder.co.inv
          >alid> posted at Wed, 24 Dec 2003 15:10:26 :-[color=green]
          >>Atif wrote:[/color]
          >[color=green][color=darkred]
          >>> In my html page I want to add an image say of 800x600. Now I want that
          >>> when ever I am given two coordinates on this image say (x1, y1)=(50,
          >>> 100) and (x2, y2)=(200, 300), the java script code will trace these
          >>> coordinates on the image and draw the line between these two points.
          >>> Can anyone please help me in writing the javascript code of this
          >>> problem?[/color]
          >>
          >>As far as I know, JavaScript has no drawing capabilities. I would
          >>imagine that the only way you can accomplish this is using a Java
          >>applet, or some other multimedia object like Flash.[/color]
          >
          >As a Rather Desperate Move, is it possible to take a graphic of a line,
          >say a black diagonal on a transparent 800*600 area, and scale & position
          >it over the existing image? Such a line, in a suitable graphical
          >format, should not need a large file. Several, of different sizes,
          >would be needed in order that the line-width would not scale into
          >invisibility .[/color]

          <URL: http://members.aol.com/_ht_a/hikksno...hit/index.html />

          Is a page that I made a while back that does about what the OP wanted. It uses
          divs and a 1x1 image and moves them between the points to create the line. That
          one is 400 pixels wide and when it gets larger, it gets slower. Wouldn't be
          hard to adapt it to work in IE4 as well, I know it works in IE5+, NS6+ and
          Opera.

          --
          Randy

          Comment

          • DU

            #6
            Re: Drawing line using map coordinates

            Atif wrote:[color=blue]
            > Hello all,
            > In my html page I want to add an image say of 800x600. Now I want that
            > when ever I am given two coordinates on this image say (x1, y1)=(50,
            > 100) and (x2, y2)=(200, 300), the java script code will trace these
            > coordinates on the image and draw the line between these two points.
            > Can anyone please help me in writing the javascript code of this
            > problem?
            >
            > Thanks and Regards
            > Atif[/color]


            As others mentioned, this is best done with SVG. SVG has all the
            capabilities and more (much more) to satisfy your requirements.

            DU

            Comment

            • Lasse Reichstein Nielsen

              #7
              Re: Drawing line using map coordinates

              DU <drunclear@hotW IPETHISmail.com > writes:
              [color=blue]
              > As others mentioned, this is best done with SVG. SVG has all the
              > capabilities and more (much more) to satisfy your requirements.[/color]

              Which browsers support SVG?

              /L
              --
              Lasse Reichstein Nielsen - lrn@hotpop.com
              DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
              'Faith without judgement merely degrades the spirit divine.'

              Comment

              • Jim Ley

                #8
                Re: Drawing line using map coordinates

                On Thu, 25 Dec 2003 12:36:10 +0100, Lasse Reichstein Nielsen
                <lrn@hotpop.com > wrote:
                [color=blue]
                >DU <drunclear@hotW IPETHISmail.com > writes:
                >[color=green]
                >> As others mentioned, this is best done with SVG. SVG has all the
                >> capabilities and more (much more) to satisfy your requirements.[/color]
                >
                >Which browsers support SVG?[/color]

                There's no browsers with good native support other than X-Smiles, but
                with that not having any HTML capability... (Mozilla's SVG has good
                support for some parts, and Konq in KDE 3.2 ships with KSVG, but it
                doesn't do mixed namespace stuff.)

                Mainly it's plugin based such as Adobe SVG Viewer, for Mac/Win/Linux ,
                or Corel's SVG Viewer for Windows. There are also X-Smiles and DENG
                of the XML family, but they're a bit impractical for proper users.

                There's also Batik's Squiggle an excellent standalone java browser.

                Most people will have ASV 3, normally you would include it in a page
                with IFRAME or OBJECT, and script it internally.

                Safari, Opera, IE, Gecko family on Win/Mac all go okay with asv3
                (although you'll need the 3.01 ASV release for Gecko family), on Linux
                the 3.01 release will give you Konqi and Gecko support, although there
                are some limitations - no sound for example - there's no non-GPL
                common sound library on linux I believe.

                Jim.


                --
                comp.lang.javas cript FAQ - http://jibbering.com/faq/

                Comment

                • Jim Ley

                  #9
                  Re: Drawing line using map coordinates

                  On Thu, 25 Dec 2003 12:36:10 +0100, Lasse Reichstein Nielsen
                  <lrn@hotpop.com > wrote:
                  [color=blue]
                  >DU <drunclear@hotW IPETHISmail.com > writes:
                  >[color=green]
                  >> As others mentioned, this is best done with SVG. SVG has all the
                  >> capabilities and more (much more) to satisfy your requirements.[/color]
                  >
                  >Which browsers support SVG?[/color]


                  and


                  are examples which roughly do what the OP wants aswell.

                  Jim.
                  --
                  comp.lang.javas cript FAQ - http://jibbering.com/faq/

                  Comment

                  • Dr John Stockton

                    #10
                    Re: Drawing line using map coordinates

                    JRS: In article <bsdj6c$ldi$1@n ews.eusc.inter. net>, seen in
                    news:comp.lang. javascript, DU <drunclear@hotW IPETHISmail.com > posted at
                    Wed, 24 Dec 2003 21:48:37 :-[color=blue]
                    >Atif wrote:[/color]
                    [color=blue][color=green]
                    >> In my html page I want to add an image say of 800x600. Now I want that
                    >> when ever I am given two coordinates on this image say (x1, y1)=(50,
                    >> 100) and (x2, y2)=(200, 300), the java script code will trace these
                    >> coordinates on the image and draw the line between these two points.
                    >> Can anyone please help me in writing the javascript code of this
                    >> problem?[/color][/color]
                    [color=blue]
                    >As others mentioned, this is best done with SVG. SVG has all the
                    >capabilities and more (much more) to satisfy your requirements.[/color]

                    Such a recommendation is better accompanied by an indication of where to
                    seek more information, and what is required to run SVG.

                    I have no recollection of the term, and suspect that SVG may not be
                    available to me.

                    --
                    © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
                    <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
                    <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
                    <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

                    Comment

                    • DU

                      #11
                      Re: Drawing line using map coordinates

                      Dr John Stockton wrote:
                      [color=blue]
                      > JRS: In article <bsdj6c$ldi$1@n ews.eusc.inter. net>, seen in
                      > news:comp.lang. javascript, DU <drunclear@hotW IPETHISmail.com > posted at
                      > Wed, 24 Dec 2003 21:48:37 :-
                      >[color=green]
                      >>Atif wrote:[/color]
                      >
                      >[color=green][color=darkred]
                      >>>In my html page I want to add an image say of 800x600. Now I want that
                      >>>when ever I am given two coordinates on this image say (x1, y1)=(50,
                      >>>100) and (x2, y2)=(200, 300), the java script code will trace these
                      >>>coordinate s on the image and draw the line between these two points.
                      >>>Can anyone please help me in writing the javascript code of this
                      >>>problem?[/color][/color]
                      >
                      >[color=green]
                      >>As others mentioned, this is best done with SVG. SVG has all the
                      >>capabilitie s and more (much more) to satisfy your requirements.[/color]
                      >
                      >
                      > Such a recommendation is better accompanied by an indication of where to
                      > seek more information, and what is required to run SVG.
                      >[/color]


                      Google.com, searching for svg newsgroups, etc... was a start. I was in
                      no way preventing the original poster to ask back for more clues, hints,
                      etc. on how to achieve what he wants with SVG. My post was not imposing
                      any implicit constraint.

                      FWIW, the Adobe SVG plugin is a good place to start. As mentioned by Jim
                      L., Mozilla can now make use of the Adobe SVG plugin (this is very
                      recent news: http://bugzilla.mozilla.org/show_bug.cgi?id=133567#c67 ).



                      DU
                      [color=blue]
                      > I have no recollection of the term, and suspect that SVG may not be
                      > available to me.
                      >[/color]

                      Comment

                      • DU

                        #12
                        Re: Drawing line using map coordinates

                        DU wrote:

                        As mentioned by Jim[color=blue]
                        > L., Mozilla can now make use of the Adobe SVG plugin (this is very
                        > recent news: http://bugzilla.mozilla.org/show_bug.cgi?id=133567#c67 ).[/color]

                        I may have spoken too soon. Adobe SVG plugin 3.01 won't work for
                        Gecko-based browsers on Windows. The news is that a beta version of the
                        plugin may work for RedHat Linux users instead.

                        DU

                        Comment

                        • DU

                          #13
                          Re: Drawing line using map coordinates

                          Jim Ley wrote:

                          [snipped]
                          [color=blue]
                          >
                          > Safari, Opera, IE, Gecko family on Win/Mac all go okay with asv3
                          > (although you'll need the 3.01 ASV release for Gecko family),[/color]

                          Are you sure about this? I'm using a recent build of Mozilla 1.7alpha
                          and downloaded and installed ASV 3.01

                          Also, no mention of ASV 3.01 at


                          As I understand it, ASV 3.01 is just a security release.

                          DU

                          on Linux[color=blue]
                          > the 3.01 release will give you Konqi and Gecko support, although there
                          > are some limitations - no sound for example - there's no non-GPL
                          > common sound library on linux I believe.
                          >
                          > Jim.
                          >
                          >[/color]

                          Comment

                          • Jim Ley

                            #14
                            Re: Drawing line using map coordinates

                            On Thu, 25 Dec 2003 14:18:22 -0500, DU <drunclear@hotW IPETHISmail.com >
                            wrote:
                            [color=blue]
                            >Jim Ley wrote:
                            >
                            >[snipped][color=green]
                            >> Safari, Opera, IE, Gecko family on Win/Mac all go okay with asv3
                            >> (although you'll need the 3.01 ASV release for Gecko family),[/color]
                            >
                            >Are you sure about this? I'm using a recent build of Mozilla 1.7alpha
                            >and downloaded and installed ASV 3.01[/color]

                            I certainly believe so, 6preview certainly works with it and I'd heard
                            reports that 3.01 does to, it doesn't install itself so you need to do
                            it manually. I understood the fix which stopped it working in Mozilla
                            post 0.9.something also got rolled into into the recent release. ASV6
                            then if I'm wrong.

                            Jim.

                            --
                            comp.lang.javas cript FAQ - http://jibbering.com/faq/

                            Comment

                            • Kien

                              #15
                              Re: Drawing line using map coordinates

                              I use mulitple dots to draw lines
                              like these graphs:


                              Kien


                              Dr John Stockton <spam@merlyn.de mon.co.uk> wrote in message news:<AUI8ZcGgX s6$Ew1Q@merlyn. demon.co.uk>...[color=blue]
                              > JRS: In article <bsdj6c$ldi$1@n ews.eusc.inter. net>, seen in
                              > news:comp.lang. javascript, DU <drunclear@hotW IPETHISmail.com > posted at
                              > Wed, 24 Dec 2003 21:48:37 :-[color=green]
                              > >Atif wrote:[/color]
                              >[color=green][color=darkred]
                              > >> In my html page I want to add an image say of 800x600. Now I want that
                              > >> when ever I am given two coordinates on this image say (x1, y1)=(50,
                              > >> 100) and (x2, y2)=(200, 300), the java script code will trace these
                              > >> coordinates on the image and draw the line between these two points.
                              > >> Can anyone please help me in writing the javascript code of this
                              > >> problem?[/color][/color]
                              >[color=green]
                              > >As others mentioned, this is best done with SVG. SVG has all the
                              > >capabilities and more (much more) to satisfy your requirements.[/color]
                              >
                              > Such a recommendation is better accompanied by an indication of where to
                              > seek more information, and what is required to run SVG.
                              >
                              > I have no recollection of the term, and suspect that SVG may not be
                              > available to me.[/color]

                              Comment

                              Working...