Solved

draw some building structures, Canvas in Delphi

Posted on 2009-05-19
14
906 Views
Last Modified: 2012-05-07
Dear all.
I've learned how use Canvas Object for creating basical shape like circle, square, arc and so on.
I am interested in creating 2D shape for drawing house project like this one:

http://www.eioba.pl/files/user598/dompastwakania2sj7.png

So I need to create simple Shape for "desk with chairs", chair, stairs, "L" and "U"walls ....

I could play with the canvas functions and do it by myself by the way i was thinking if
such library or procedure are already bee created by someone else in internet
so I would speed up with my project.

it does exsist a software that generate delphi code for a shape
to be used in my procedure? So i can create my TMyShapeDesk Class?

Thx a lot.
0
Comment
Question by:jaja2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
14 Comments
 
LVL 8

Assisted Solution

by:BdLm
BdLm earned 25 total points
ID: 24425715
this one helps :   http://www.flex-graphics.com/   ??
0
 

Author Comment

by:jaja2005
ID: 24426137
hmmm probably not because my goal is to find code to use.
I am using TeeTree:

http://www.steema.com/products/teetree/whatsnew.html

But here there are a only a few sample of Shape.

Here an example:

procedure TMyActorShape.DrawShapeCanvas(ACanvas: TCanvas3D; const R: TRect);
var tmpX : Integer;
    tmpY : Integer;
    tmpY2 : Integer;
    tmp : Integer;
begin
   inherited;
with R do
begin
tmpX:=(Right+Left) div 2;
tmpY:=(Bottom-Top) div 3;
tmpY2:=(Bottom-Top) div 9;
end;

with ACanvas do
begin
HorizLine3D(R.Left,R.Right,R.Top+tmpY,TeeTreeZ);
VertLine3D(tmpX,R.Top+tmpY-tmpY2,R.Bottom-tmpY,TeeTreeZ);
LineWithZ(tmpX,R.Bottom-tmpY,R.Left,R.Bottom,TeeTreeZ);
LineWithZ(tmpX,R.Bottom-tmpY,R.Right,R.Bottom,TeeTreeZ);
tmp:=(tmpY-tmpY2) div 2;
EllipseWithZ(tmpX-tmp,R.Top,tmpX+tmp,R.Top+tmp+tmp,TeeTreeZ);
 end;
end;


So in ACanvas I want to draw my own shape (clouds, desk, tree, gate, doors, windows..).


Thx






0
 
LVL 26

Assisted Solution

by:EddieShipman
EddieShipman earned 275 total points
ID: 24426453
You really should be using this:
http://www.codeaccelerate.com/drawing_engine.html
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

Author Comment

by:jaja2005
ID: 24426812
Hi. I have installed the package, I see all the components in palette but actually I don't
undestand how I could use them in the procedure I showed you before and what advantages
they offer compared with the standard canvas procedures. I need to draw the shape
via code...

Thx in advance
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 24428079
You need to create shape classes and program them to draw like you want.
0
 

Author Comment

by:jaja2005
ID: 24429182
do you have some example? I see that the documentation is quite poor.
0
 
LVL 26

Assisted Solution

by:EddieShipman
EddieShipman earned 275 total points
ID: 24431104
Well, I don't know the dimensions or shape that you want to draw. There are examples included of shape classes in the package, I believe, that you can see how to do it.
0
 

Author Comment

by:jaja2005
ID: 24431173
Oki. How you would compare it with this?

http://www.tmssoftware.com/site/diagram.asp?s=
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 24432478
That's all fine if you want the objects already created. Apparently, you want some things specially designed and you are going to have to do that yourself.
0
 

Author Comment

by:jaja2005
ID: 24441414
I do undestand. Thanks.

I've attached some picture of what I would like to achive.

1. Have seen the example of how create a mult-iline shape by clicking on the Diagram. Generally I would like to get
the same effect adding some code in my procedure DrawShapeCanvas for drawing a piece of wall as showed in my screenshot
and then fill it with my ow brush or simple color.

2. I would like to create a basical simple shape like TMychair and use them for a table in "conference room". You see
the second pic.  Here you see a red-square around the table which is a TRect type to draw in. (note TMyActorShape
is draggable on Diagram component so when I perform this action all the "shape" in ACanvas should move accordgly (charis, bottle of water :-) , table...)

How I can achive it?
Any code example?

Thx
1.jpg
2.jpg
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 24455782
There is a component on the Additional Tab called TShape. Make a copy of the code and modify the Paint to draw a chair, a table,and whatever, like it does with a Square, Rectangle, RoundRect, etc.
0
 

Author Comment

by:jaja2005
ID: 24457293
I know where Tshape is it. I was searching for other kind of information like How paint shapes, graphics algoritms...If someone else
have done it using pascal for exmaple drawing clouds I would look into his code ...




 

0
 

Author Comment

by:jaja2005
ID: 24457305
My previous question (1 and 2) are also very specific.
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 275 total points
ID: 24458022
Looks like the chair is drawn with 3 ellipses and a round rect, all you need is to calculate the position and sizes.
Remember, TShape is a graphic control and does not respond to mouse messages so you really need to inherit from TComponent and build from there.

AFA No.1 is concerned, all you have to do is draw the two parallel lines at the same time
that is not hard to do. Take the position when the mouse button is pressed and set position 1 to the mouse position + 1/2 the width of the wall, set position 2 to the mouse position - 1/2 the width of the wall. then do the same thing when the button is released and draw lines from position1 to position 3 and position 2 to position 4.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question