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

    #46
    Re: Line Drawing in Alpha

    Hey Raymond, we missed something else. The original drawing has begin and end points circled.

    Change the actual drawing lines to

    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
    There can be only one.

    Comment


      #47
      Re: Line Drawing in Alpha

      Stan, Thank you so much for your help, I'm sure Alpha Five New and Advance Users will appreciate it. I'm trying to learn the commands you used in the code and the logic of how codes work that way, I tried to put some test data coming from the MS access app and I compared the output and I think your solution is more accurate,In adding some more data, I found out that the plot image is not centered, i have attached the output image, I'm trying to make it appear at the center because sometimes if i click the draw plot, the output is on the side and sometimes on top and other lines are not visible, BTW, How can we save the Image on the table so that it will be available for printing including the Header and Detail data? With all the codes given by Stan, it is probably to much for him to give all the codes for that, I'm trying to do that so that i will not be spoon fed by Stan, but being new to alpha,I just asked so that just in case I cannot solve it then maybe Stan and others will be so Kind and generous AGAIN to share their Alpha Five Knowledge to Everyone.
      Attached Files
      Last edited by JetLi; 03-01-2012, 09:17 PM.

      Comment


        #48
        Re: Line Drawing in Alpha

        Originally posted by Stan Mathews View Post
        Hey Raymond, we missed something else. The original drawing has begin and end points circled.

        Change the actual drawing lines to

        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
        Again, thanks Stan. However, I have had to have lot lines drawn before for building permit purposes and was never told to include starting an end points of all the lines. Of course that could easily be a user prompt to have or not have them (presumably Jetli would know how to do that--I hope).

        JetLi, look at ui_printer_draw() for printing. And of course the next question how to make it larger for printing. Stan?

        Raymond Lyons

        Comment


          #49
          Re: Line Drawing in Alpha

          Raymond,

          Feel free to offer modifications and improvements as you see fit. No need to wait for me.

          JetLi,

          There is much that could be added to my process. To have the drawing centered in the screen area one would likely need to total all the horizontal and vertical measurements, choose a starting point based on some calculation of those, and define the screen dimensions based on another calculation.

          An alternative might be to ensure that the starting line heads south and east. This might be done by choosing the first south by east line and loop through the rest in order, returning to the first child record when the last is drawn.

          There are several functions to save the bitmap created to a variable and to save that variable as a file

          ui_bitmap_save()
          BITMAP_TO_JPEG()

          Once saved as a jpg file you can use sys_print() to print the image using the registered application for the jpg file extension. Just an alternative to ui_printer_draw().
          There can be only one.

          Comment


            #50
            Re: Line Drawing in Alpha

            Originally posted by Stan Mathews View Post
            ....There are several functions to save the bitmap created to a variable and to save that variable as a file

            ui_bitmap_save()
            BITMAP_TO_JPEG()

            Once saved as a jpg file you can use sys_print() to print the image using the registered application for the jpg file extension. Just an alternative to ui_printer_draw().
            I think I prefer saving it as a bitmap and then printing it as Stan suggests. But, below is a slight alteration of Stan's code (in the middle--page_code--and at the end) that will let you print it with ui_printer_draw(). As for the other tweaks (positioning, centering, adding verbiage, etc.), that is more than I have time for right now--not that I am programming, it's just that another type of life is intervening!

            Raymond Lyons

            [Edit]: One needs Stan's files in an app to run the code below.
            Code:
            'Date Created: 01-Mar-2012 01:22:29 PM
            'Last Updated: 01-Mar-2012 08:38:13 PM
            'Created By  : SMathews
            'Updated By  : Raymond Lyons
            chld = table.current(2)
            strt1x = 2
            strt1y = 1
            chld_rec = a5_get_records_in_query("plot_vect","lot_number = "+quote(lot_number.value))
            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",6,6)
            page_code=<<%code%
            inner_Rect(0,0,6,6)
            start_poly(strt1x,strt1y)
            for xq =  1 to chld_rec
            	evaluate_template("lineto(end"+alltrim(str(xq))+"x,end"+alltrim(str(xq))+"y)")
            next xq
            poly(2,1)
            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_bitmap_draw("test",page_code)
            
            ui_dlg_box("","{image=test}")
            
            dim response as n
            response = ui_msg_box("Print","Print Now? ",UI_QUESTION_SYMBOL+UI_FIRST_BUTTON_DEFAULT+UI_YES_NO)
            if response <> 6'YES
                end
            end if
            
            dim printer as c
            printer = ui_printer_default_get()
            on error goto no_print
            ui_printer_draw(printer, "" ,"",page_code,.T.)	'setting ".T." to ".F." does not work for me????
            end
            no_print:
            ui_msg_box("Error","Print Canceled",UI_OK)
            end
            Last edited by Raymond Lyons; 03-02-2012, 01:07 PM.

            Comment


              #51
              Re: Line Drawing in Alpha

              Is it advisable to save the plot to a table? So that when printing records Names,Address,tel no etc. together with the image will just be extracted for printing. With thousands of records to be encoded in the future and with the image saved, will it affect the speed in searching records in Alpha? That is the main problem of the msaccess application, when users search, it takes about 3 to 5 minutes just to display/searched from 120,000 records.

              Comment


                #52
                Re: Line Drawing in Alpha

                Is it advisable to save the plot to a table?
                Absolutely not. Alpha has a field type, image file reference, where you can store the location of the plot files. Using this field type saves space in the table but keeps the images available.
                There can be only one.

                Comment


                  #53
                  Re: Line Drawing in Alpha

                  Originally posted by Raymond Lyons View Post
                  I think I prefer saving it as a bitmap and then printing it as Stan suggests. But, below is a slight alteration of Stan's code (in the middle--page_code--and at the end) that will let you print it with ui_printer_draw(). As for the other tweaks (positioning, centering, adding verbiage, etc.), that is more than I have time for right now--not that I am programming, it's just that another type of life is intervening!

                  Raymond Lyons

                  [Edit]: One needs Stan's files in an app to run the code below.
                  Code:
                  'Date Created: 01-Mar-2012 01:22:29 PM
                  'Last Updated: 01-Mar-2012 08:38:13 PM
                  'Created By  : SMathews
                  'Updated By  : Raymond Lyons
                  chld = table.current(2)
                  strt1x = 2
                  strt1y = 1
                  chld_rec = a5_get_records_in_query("plot_vect","lot_number = "+quote(lot_number.value))
                  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",6,6)
                  page_code=<<%code%
                  inner_Rect(0,0,6,6)
                  start_poly(strt1x,strt1y)
                  for xq =  1 to chld_rec
                  	evaluate_template("lineto(end"+alltrim(str(xq))+"x,end"+alltrim(str(xq))+"y)")
                  next xq
                  poly(2,1)
                  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_bitmap_draw("test",page_code)
                  
                  ui_dlg_box("","{image=test}")
                  
                  dim response as n
                  response = ui_msg_box("Print","Print Now? ",UI_QUESTION_SYMBOL+UI_FIRST_BUTTON_DEFAULT+UI_YES_NO)
                  if response <> 6'YES
                      end
                  end if
                  
                  dim printer as c
                  printer = ui_printer_default_get()
                  on error goto no_print
                  ui_printer_draw(printer, "" ,"",page_code,.T.)	'setting ".T." to ".F." does not work for me????
                  end
                  no_print:
                  ui_msg_box("Error","Print Canceled",UI_OK)
                  end
                  Where will we put the Ui_Bitmap_Save? i tried to put it before "dim printer as c" but nothing happens.

                  Comment


                    #54
                    Re: Line Drawing in Alpha

                    Originally posted by JetLi View Post
                    Where will we put the Ui_Bitmap_Save? i tried to put it before "dim printer as c" but nothing happens.
                    JetLi, you are going to have to learn how to use the Help files. I went to the wiki version and quickly found some code that will at least get you started. Obviously if you have many bitmaps to save you need a way to change a hard code file name, change the target folder etc., all of which you can find in the Help files and wiki. I am not going to be able to help you any further.

                    That said, put the following code just after the ui_dlg_box("","{image_test"}) line.

                    Raymond Lyons

                    Code:
                    dim response as n
                    response=ui_msg_box("Save to Jpeg?", "Do you want to save this bipmap as a Jpeg file to the root of your C drive?",UI_QUESTION_SYMBOL+UI_FIRST_BUTTON_DEFAULT+UI_YES_NO)
                    if response=6	'yes
                    	saveb = ui_bitmap_save("test")
                    	savej = bitmap_to_jpeg(saveb)
                    	fptr = file.create("c:\Lot Plot.jpg", FILE_RW_EXCLUSIVE)
                    	fptr.writeb(savej)
                    	fptr.close()
                    end if

                    Comment


                      #55
                      Re: Line Drawing in Alpha

                      Thank you Raymond!

                      Comment


                        #56
                        Re: Line Drawing in Alpha

                        Jetli,

                        Can I interject a question - You want to draw shapes that represent property lots. But don't you want to draw that shape on top of a MAP of the area to show the outline of the plot in the proper context. As an example, the attached image shows a Google map wth faint lines representing property lots.
                        Attached Files
                        Steve Wood
                        See my profile on IADN

                        Comment


                          #57
                          Re: Line Drawing in Alpha

                          Thank you Steve for the suggestion, How can we do that? is every place in this earth visible in Google MaP? Im so sorry for my ignorance.

                          Comment


                            #58
                            Re: Line Drawing in Alpha

                            Now that I think of it, you cannot plot it on a map unless you have latitude / longitude for at least one of your coordinates. Your survey data is "pre-GPS" and without lat/long or an address, it is just a shape. I probably should not have interupted the discussion on making this work in Alpha.
                            Steve Wood
                            See my profile on IADN

                            Comment


                              #59
                              Re: Line Drawing in Alpha

                              This thread is interesting at several levels:
                              First: The title:
                              I am one of those who read the book by its cover. The title says something about drawing a line with alpha. I thought to myself: how hard could that be? and moved on..
                              But when the thread lived to see a second page.. I got curious, what seems to be the problem?
                              Well, it wasn't about drawing a line but rather drawing a "shape" and not any shape, but one based on a survey.
                              Lesson?: Choose your thread title carefully

                              Second:
                              Well, I said, what's the big deal? I wrote a function years ago to generate any shape from any given set of data. I could modify that function and post it here.
                              That's, until I came across a post by Ira discussing consultation fees. I am the last one to interfere with any business transaction, so I figured I'd better leave this alone.
                              There is no lesson here but rather a comment or two.
                              Some feel the message board is meant for sharing and helping one another. And it is. Some feel that it should be all free.
                              I don't share that sentiment even though I don't have a dog in this fight. It's perfectly OK to present your services and your consultation fees. Many users just simply don't have the time or the desire to do a project on their own. But, I'd imagine anyone will take anything if they can get it for free rather than pay for it.

                              And, there is a little lesson here: you get what you pay for.

                              The solutions provided here are great, but not complete. I am sure they can be made complete with more time and devotion. Surveys are not written the way they were presented in this thread in the form of a table and fields. Furthermore, not all plots of lands run in straight lines, many run along curves, sometimes many many curves (arcs). That was not addressed either. So, you might need a consultant after all.

                              Lastly, Steve Woods wanted to plot the survey on a map. Yes you can do that with an address. You don't need Latitude/Longitude. But again, many surveys don't have a municipal address but rather a legal address. In the US, surveys are based on Meridians, Sections and townships. Worse, in many rural areas, they are based on metes and bounds!
                              You get the idea?
                              Before you take on this assignment, make sure you know what you are getting into.

                              Comment


                                #60
                                Re: Line Drawing in Alpha

                                Whew, I tried but could not center it on the report,Hope someone will put the code on how to center the image once the plot button is clicked.

                                Comment

                                Working...
                                X