Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Line Drawing in Alpha

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #61
    Re: Line Drawing in Alpha

    This code "centers" the drawing using the original coordinates in the discussion. I did not work on adjusting the north arrow rendering.

    Code:
    chld = table.current(2)
    'test pass to get minimum and maximum x and y values to determine the overall dimensions needed.
    minx = 1
    miny = 1
    maxx  = 1
    maxy = 1
    strt1x = 1
    strt1y = 1
    chld_rec = a5_get_records_in_query("plot_vect","lot_number = "+quote(lot_number.value))
    dim test_vars as P
    FOR qm = 1 TO chld_rec
    	chld.record_to_vars(test_vars)
    	eval("l"+alltrim(str(qm))+"ns") = test_vars.dir_ns
    	eval("l"+alltrim(str(qm))+"ew") = test_vars.dir_ew
    	eval("l"+alltrim(str(qm))+"xmod") = if(test_vars.dir_ew = "E",1,-1)
    	eval("l"+alltrim(str(qm))+"ymod") = if(test_vars.dir_ns = "S",1,-1)
    	eval("l"+alltrim(str(qm))+"lnth") = test_vars.distance/100
    	eval("l"+alltrim(str(qm))+"decdeg") = test_vars.bear_deg+(test_vars.bear_min/60)
    	eval("l"+alltrim(str(qm))+"adj") = cos(dtor(eval("l"+alltrim(str(qm))+"decdeg")))*eval("l"+alltrim(str(qm))+"lnth")
    	eval("l"+alltrim(str(qm))+"opp") = sin(dtor(eval("l"+alltrim(str(qm))+"decdeg")))*eval("l"+alltrim(str(qm))+"lnth")
    	IF qm = 1
    		eval("end"+alltrim(str(qm))+"x") = eval("strt"+alltrim(str(qm))+"x")+(eval("l"+alltrim(str(qm))+"xmod")*eval("l"+alltrim(str(qm))+"opp"))
    		eval("end"+alltrim(str(qm))+"y") = eval("strt"+alltrim(str(qm))+"y")+(eval("l"+alltrim(str(qm))+"ymod")*eval("l"+alltrim(str(qm))+"adj"))
    	ELSE
    		eval("end"+alltrim(str(qm))+"x") = eval("end"+alltrim(str(qm-1))+"x")+(eval("l"+alltrim(str(qm))+"xmod")*eval("l"+alltrim(str(qm))+"opp"))
    		eval("end"+alltrim(str(qm))+"y") = eval("end"+alltrim(str(qm-1))+"y")+(eval("l"+alltrim(str(qm))+"ymod")*eval("l"+alltrim(str(qm))+"adj"))
    	END IF
    	maxx = max(eval("end"+alltrim(str(qm))+"x"),maxx)
    	minx = min(eval("end"+alltrim(str(qm))+"x"),minx)
    	maxy = max(eval("end"+alltrim(str(qm))+"y"),maxy)
    	miny = min(eval("end"+alltrim(str(qm))+"y"),miny)
    	chld.fetch_next()
    NEXT qm	
    xdim = (maxx - minx) + 2
    ydim = (maxy - miny) + 2
    
    'live pass
    strt1x = 1+abs(minx-1)
    strt1y = 1+abs(miny-1)
    chld_rec = a5_get_records_in_query("plot_vect","lot_number = "+quote(lot_number.value))
    chld.fetch_first()
    dim vars as P
    FOR qx =  1 TO chld_rec
    	chld.record_to_vars(vars)
    	eval("l"+alltrim(str(qx))+"ns") = vars.dir_ns
    	eval("l"+alltrim(str(qx))+"ew") = vars.dir_ew
    	eval("l"+alltrim(str(qx))+"xmod") = if(vars.dir_ew = "E",1,-1)
    	eval("l"+alltrim(str(qx))+"ymod") = if(vars.dir_ns = "S",1,-1)
    	eval("l"+alltrim(str(qx))+"lnth") = vars.distance/100
    	eval("l"+alltrim(str(qx))+"decdeg") = vars.bear_deg+(vars.bear_min/60)
    	eval("l"+alltrim(str(qx))+"adj") = cos(dtor(eval("l"+alltrim(str(qx))+"decdeg")))*eval("l"+alltrim(str(qx))+"lnth")
    	eval("l"+alltrim(str(qx))+"opp") = sin(dtor(eval("l"+alltrim(str(qx))+"decdeg")))*eval("l"+alltrim(str(qx))+"lnth")
    	IF qx = 1
    		eval("end"+alltrim(str(qx))+"x") = eval("strt"+alltrim(str(qx))+"x")+(eval("l"+alltrim(str(qx))+"xmod")*eval("l"+alltrim(str(qx))+"opp"))
    		eval("end"+alltrim(str(qx))+"y") = eval("strt"+alltrim(str(qx))+"y")+(eval("l"+alltrim(str(qx))+"ymod")*eval("l"+alltrim(str(qx))+"adj"))
    	ELSE
    		eval("end"+alltrim(str(qx))+"x") = eval("end"+alltrim(str(qx-1))+"x")+(eval("l"+alltrim(str(qx))+"xmod")*eval("l"+alltrim(str(qx))+"opp"))
    		eval("end"+alltrim(str(qx))+"y") = eval("end"+alltrim(str(qx-1))+"y")+(eval("l"+alltrim(str(qx))+"ymod")*eval("l"+alltrim(str(qx))+"adj"))
    	END IF
    	chld.fetch_next()
    NEXT qx
    ui_bitmap_create("test",xdim,ydim)
    ui_bitmap_draw("test",<<%code%
    inner_Rect(0,0,xdim,ydim)
    start_poly(strt1x,strt1y)
    for xq =  1 to chld_rec
    	evaluate_template("oval(end"+alltrim(str(xq))+"x-.02,end"+alltrim(str(xq))+"y-.02,.06,.06)")
    	evaluate_template("lineto(end"+alltrim(str(xq))+"x,end"+alltrim(str(xq))+"y)")
    next xq
    poly(strt1x,strt1y)
    start_poly(4,4)
    lineto(4,5)
    poly(4,5)
    start_poly(4,4)
    lineto(3.9,4.5)
    poly(4,4)
    start_poly(4,4)
    lineto(4.1,4.5)
    poly(4,4)
    TEXT("N",3.95,5.2)
    %code%)
    ui_dlg_box("","{image=test}")
    There can be only one.

    Comment


      #62
      Re: Line Drawing in Alpha

      Originally posted by Stan Mathews View Post
      This code "centers" the drawing using the original coordinates in the discussion. I did not work on adjusting the north arrow rendering.

      Code:
      chld = table.current(2)
      'test pass to get minimum and maximum x and y values to determine the overall dimensions needed.
      minx = 1
      miny = 1
      maxx  = 1
      maxy = 1
      strt1x = 1
      strt1y = 1
      chld_rec = a5_get_records_in_query("plot_vect","lot_number = "+quote(lot_number.value))
      dim test_vars as P
      FOR qm = 1 TO chld_rec
      	chld.record_to_vars(test_vars)
      	eval("l"+alltrim(str(qm))+"ns") = test_vars.dir_ns
      	eval("l"+alltrim(str(qm))+"ew") = test_vars.dir_ew
      	eval("l"+alltrim(str(qm))+"xmod") = if(test_vars.dir_ew = "E",1,-1)
      	eval("l"+alltrim(str(qm))+"ymod") = if(test_vars.dir_ns = "S",1,-1)
      	eval("l"+alltrim(str(qm))+"lnth") = test_vars.distance/100
      	eval("l"+alltrim(str(qm))+"decdeg") = test_vars.bear_deg+(test_vars.bear_min/60)
      	eval("l"+alltrim(str(qm))+"adj") = cos(dtor(eval("l"+alltrim(str(qm))+"decdeg")))*eval("l"+alltrim(str(qm))+"lnth")
      	eval("l"+alltrim(str(qm))+"opp") = sin(dtor(eval("l"+alltrim(str(qm))+"decdeg")))*eval("l"+alltrim(str(qm))+"lnth")
      	IF qm = 1
      		eval("end"+alltrim(str(qm))+"x") = eval("strt"+alltrim(str(qm))+"x")+(eval("l"+alltrim(str(qm))+"xmod")*eval("l"+alltrim(str(qm))+"opp"))
      		eval("end"+alltrim(str(qm))+"y") = eval("strt"+alltrim(str(qm))+"y")+(eval("l"+alltrim(str(qm))+"ymod")*eval("l"+alltrim(str(qm))+"adj"))
      	ELSE
      		eval("end"+alltrim(str(qm))+"x") = eval("end"+alltrim(str(qm-1))+"x")+(eval("l"+alltrim(str(qm))+"xmod")*eval("l"+alltrim(str(qm))+"opp"))
      		eval("end"+alltrim(str(qm))+"y") = eval("end"+alltrim(str(qm-1))+"y")+(eval("l"+alltrim(str(qm))+"ymod")*eval("l"+alltrim(str(qm))+"adj"))
      	END IF
      	maxx = max(eval("end"+alltrim(str(qm))+"x"),maxx)
      	minx = min(eval("end"+alltrim(str(qm))+"x"),minx)
      	maxy = max(eval("end"+alltrim(str(qm))+"y"),maxy)
      	miny = min(eval("end"+alltrim(str(qm))+"y"),miny)
      	chld.fetch_next()
      NEXT qm	
      xdim = (maxx - minx) + 2
      ydim = (maxy - miny) + 2
      
      'live pass
      strt1x = 1+abs(minx-1)
      strt1y = 1+abs(miny-1)
      chld_rec = a5_get_records_in_query("plot_vect","lot_number = "+quote(lot_number.value))
      chld.fetch_first()
      dim vars as P
      FOR qx =  1 TO chld_rec
      	chld.record_to_vars(vars)
      	eval("l"+alltrim(str(qx))+"ns") = vars.dir_ns
      	eval("l"+alltrim(str(qx))+"ew") = vars.dir_ew
      	eval("l"+alltrim(str(qx))+"xmod") = if(vars.dir_ew = "E",1,-1)
      	eval("l"+alltrim(str(qx))+"ymod") = if(vars.dir_ns = "S",1,-1)
      	eval("l"+alltrim(str(qx))+"lnth") = vars.distance/100
      	eval("l"+alltrim(str(qx))+"decdeg") = vars.bear_deg+(vars.bear_min/60)
      	eval("l"+alltrim(str(qx))+"adj") = cos(dtor(eval("l"+alltrim(str(qx))+"decdeg")))*eval("l"+alltrim(str(qx))+"lnth")
      	eval("l"+alltrim(str(qx))+"opp") = sin(dtor(eval("l"+alltrim(str(qx))+"decdeg")))*eval("l"+alltrim(str(qx))+"lnth")
      	IF qx = 1
      		eval("end"+alltrim(str(qx))+"x") = eval("strt"+alltrim(str(qx))+"x")+(eval("l"+alltrim(str(qx))+"xmod")*eval("l"+alltrim(str(qx))+"opp"))
      		eval("end"+alltrim(str(qx))+"y") = eval("strt"+alltrim(str(qx))+"y")+(eval("l"+alltrim(str(qx))+"ymod")*eval("l"+alltrim(str(qx))+"adj"))
      	ELSE
      		eval("end"+alltrim(str(qx))+"x") = eval("end"+alltrim(str(qx-1))+"x")+(eval("l"+alltrim(str(qx))+"xmod")*eval("l"+alltrim(str(qx))+"opp"))
      		eval("end"+alltrim(str(qx))+"y") = eval("end"+alltrim(str(qx-1))+"y")+(eval("l"+alltrim(str(qx))+"ymod")*eval("l"+alltrim(str(qx))+"adj"))
      	END IF
      	chld.fetch_next()
      NEXT qx
      ui_bitmap_create("test",xdim,ydim)
      ui_bitmap_draw("test",<<%code%
      inner_Rect(0,0,xdim,ydim)
      start_poly(strt1x,strt1y)
      for xq =  1 to chld_rec
      	evaluate_template("oval(end"+alltrim(str(xq))+"x-.02,end"+alltrim(str(xq))+"y-.02,.06,.06)")
      	evaluate_template("lineto(end"+alltrim(str(xq))+"x,end"+alltrim(str(xq))+"y)")
      next xq
      poly(strt1x,strt1y)
      start_poly(4,4)
      lineto(4,5)
      poly(4,5)
      start_poly(4,4)
      lineto(3.9,4.5)
      poly(4,4)
      start_poly(4,4)
      lineto(4.1,4.5)
      poly(4,4)
      TEXT("N",3.95,5.2)
      %code%)
      ui_dlg_box("","{image=test}")
      Output of the Code in alpha is attached.
      Attached Files
      Last edited by JetLi; 03-20-2012, 09:31 PM.

      Comment


        #63
        Re: Line Drawing in Alpha

        Ohh my God, Stan your a Genius you got it right, I'm so sorry , my mistake, I'm really so dumb, the mistake was on my part, Wrong data from the original data, Stan, Congratulations and I thank you so much for the work that you shared. Please see the Alpha Five Output Attached contrary to what I posted Above, I tried to delete but could not delete it,.
        Attached Files

        Comment


          #64
          Re: Line Drawing in Alpha

          Glad to help. What will make it worthwhile to me is that you understand and learn from what I gave you.

          PS You can't delete an earlier post but you can edit it........
          There can be only one.

          Comment


            #65
            Re: Line Drawing in Alpha

            Raymond,

            After rereading much of this thread I realized something. Think of all the magnificient contributions of code by Ira, Cal, Tom, and others I forget to mention at the moment and the things they have given for free. Most of these contributions received little if any acclaim though I am sure they were utilized by many.

            I'm not sure if it is the need to monetize the return on the time investment that has slowed down such contributions (if indeed they have slowed down) so much as the lack of appreciation. How many threads on this message board have provided solutions only to never hear from the original poster again?

            BTW, the order of the contributors listed above is only the way they came to mind and not indicative of any rank. Jetson has communicated his thanks in a private message as well as publicly here.
            There can be only one.

            Comment


              #66
              Re: Line Drawing in Alpha

              Stan,
              Saying thank you for my appreciation is not enough for the shared code, It's more than that,One of the best help someone could get here, i know that it will benefit not only me but for others who are interested to learn some additional capabilities of alpha,I know, If ever your going to sell this or let someone pay then I think it will be much for my pocket,and yeah to Raymond also who contributed and shared his thoughts on this post, And Of course To Tom,Ira, Cal Loclin,Ted Giles,Keith, Marion, Steve workings, Finnian,Selwyn Rabins, DaveM, MikeWilson,SteveWood,Al Buchholz,Peter,BobHoule,MoGrace etc
              and to others who tried to reply and patiently answered my queries even though it is very basic and no meaning sometimes, things like how to turn off confirmation, SQL or DBF,What to copy to clients if there are updates, Auditing, hwo to access on a network the database,how to delete , With all those questions and with your help , beginners like me are slowly getting a good grip on Alpha Five as our main development tool.Once again Thank you all! No message board such as this could be found on the Internet, There are, but supports are just given to members of a Paid Development tool.

              Comment


                #67
                Re: Line Drawing in Alpha

                This seems to work to position the north arrow relative to the centered plot. (substitute this for the existing code)

                Code:
                poly(strt1x,strt1y)
                start_poly(xdim-1,ydim)
                lineto(xdim-1,ydim-1)
                poly(xdim-1,ydim-1)
                start_poly(xdim-1,ydim-1)
                lineto(xdim-1-.1,ydim-1+.5)
                poly(xdim-1-.1,ydim-1+.5)
                start_poly(xdim-1,ydim-1)
                lineto(xdim-1+.1,ydim-1+.5)
                poly(xdim-1+.1,ydim-1+.5)
                TEXT("N",xdim-1,ydim-.2)
                There can be only one.

                Comment


                  #68
                  Re: Line Drawing in Alpha

                  Thank you Stan, Working perfectly
                  Attached Files

                  Comment


                    #69
                    Re: Line Drawing in Alpha

                    How to print the image on a report including some records on some tables like the one show in the image.?
                    Attached Files

                    Comment


                      #70
                      Re: Line Drawing in Alpha

                      polt_set.zip
                      There can be only one.

                      Comment


                        #71
                        Re: Line Drawing in Alpha

                        Originally posted by Stan Mathews View Post
                        [ATTACH]32252[/ATTACH]
                        Once again Stan Thank you so much for your help, I opened your sample and it is working fine, however I want to make it bigger just like in the microsoft access database picture attached, I'm still trying to figure out how.
                        Attached Files

                        Comment


                          #72
                          Re: Line Drawing in Alpha

                          I'm still trying to figure out how.
                          Good for you!
                          There can be only one.

                          Comment


                            #73
                            Re: Line Drawing in Alpha

                            Originally posted by Stan Mathews View Post
                            Good for you!
                            what was missing from the work of Stan on plotting, sometimes it is centered on the dialog and sometimes its not, sometimes it is of larger size and sometimes small and very small.I also noticed that the save image is not centered on the form where the actual image from the image reference field.

                            Stan, I downloaded the latest build and patch but still the images are not automatically centered in the form on the image reference field. regardless of the image created by the code to create a bitmap, is there a way in alpha five for an image reference from any folder to display on a form the image reference field and center it? if the width and length of the field on the form is small created in design mode, the image should also resize to contain the whole image.

                            Edit:
                            Sorry, for sure it is very possible in alpha five to display images of fields in image fiel reference on a form, main question is how to center it?
                            Attached Files

                            Comment


                              #74
                              Re: Line Drawing in Alpha

                              I told you to read the release notes for the latest build. I did not say the resizing was automatic.

                              Image Resizing Functions - Two new functions have been added to Xbasic to resize images. The functions allow you to resize an image by supplying an absolute size or a ratio.
                              The new function are:
                              Imaging::FileTransformer::Resize as V( InputFile as C, OutputFile as C, OutputWidth as N, OutputHeight as N)
                              Imaging::FileTransformer::ResizeByRatio as V (InputFile as C, OutputFile as C, SizeRatio as N)
                              There can be only one.

                              Comment


                                #75
                                Re: Line Drawing in Alpha

                                I see, Sorry, I apologize for that, did ot quite understand what you meant before, Prior to this 2 new functions, was there a way to center an image from an image file reference field on a form? e.g. picture of employees, in design mode of a form, I will draw a litle box to contain/display the field, is there a way to center the image based on the size that was created in design mode?
                                I have tried this code::: Imaging::FileTransformer::Resize("c:\a5samples\plot2\testpic.bmp", "c:\a5samples\plot2\testpic2.bmp",800,600)
                                prnt.Drawing = image_filename_encode("c:\a5samples\plot2\testpic2.bmp") but the image is of the same size as the original but it just made the kilobyte size smaller from the original bitmap and the quality is poor than the original too.

                                Edited:
                                A bit of trial and error, I change the height and width to smaller values to match the size of the field on the form. And it is at least centered without the North Arrow,
                                Since the new latest patch/build cannot be used in production, how then can I integrate it on the previous patches and builds ? Will we then have to wait for the official release?
                                Last edited by JetLi; 06-15-2012, 10:39 PM.

                                Comment

                                Working...
                                X