Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating 4000+ TShapes!!!

3 views
Skip to first unread message

Chris Hedges

unread,
Jun 6, 2001, 12:49:47 PM6/6/01
to
Hi there,

This is more of a 'can it be done' quastion more than a 'how' question.

I'm currently working on a project which needs to display a seatplan, e.g a
cinema or stadium.
What I want to do is to create a component to represent the seats devived
from the TShape component
which would have extra properties holding seat information, but I'm having
trouble just with the vanilla TShape without
getting flashy!!!!

The problem is I need to be able to create 3000-4000+ TShapes quickly. I've
made a test harness
which creates a grid of Tshapes on a panel within scroll box. It takes a
very long time (20-30 secs) to actually create
the components but once created and visible, re-drawing and general
perfomance is good (I though it
would be very slow at redrawing but it actually very fast)

So the point of the question is to ask if it is possible to speed up the
creation of these components, even if it
means I need to write another component derived from something other than
the TShape. I guess the message queue
is getting full or something, that is why its taking so long (please correct
me if I'm wrong as I'm curious why its so slow)

Thanks for any input or suggestions you may have, although I'm not too
hopeful that much can be
done, so any other alternative solutions would be also greatly appreciated

Cheers

Chris Hedges


Johannes Berg

unread,
Jun 6, 2001, 3:22:17 PM6/6/01
to
> This is more of a 'can it be done' quastion more than a 'how' question.

Well, the answer (IMHO) is: not really

I think you should paint them yourself and create a single component that
controls:
- seats/row
- number of rows
- ....
and holds extra information about each seat in arrays or something similar

johannes
--
Please reply in this newsgroup only
- SIP solutions -
http://www.sipsolutions.de/

Loren Pechtel

unread,
Jun 7, 2001, 3:01:22 PM6/7/01
to
>> This is more of a 'can it be done' quastion more than a 'how' question.
>
>Well, the answer (IMHO) is: not really
>
>I think you should paint them yourself and create a single component that
>controls:
> - seats/row
> - number of rows
> - ....
>and holds extra information about each seat in arrays or something similar

This is assuming that the seats fall neatly into rows. I've seen
places where that isn't exactly true.

Wayne Sherman

unread,
Jun 8, 2001, 11:59:50 AM6/8/01
to
> The problem is I need to be able to create 3000-4000+ TShapes
quickly. I've
> made a test harness
> which creates a grid of Tshapes on a panel within scroll box. It
takes a
> very long time (20-30 secs) to actually create
> the components but once created and visible, re-drawing and general
> perfomance is good (I though it
> would be very slow at redrawing but it actually very fast)

You might try creating the TShapes with no owner:

MyShape := TShape.Create(nil);


Regards,
Wayne


Dennis Landi

unread,
Jun 8, 2001, 1:45:31 PM6/8/01
to
Don't SubClass TShape for your new Seat object.

The tShape, afterall is just a GUI Element. Create your tSeat object with
all the properties and methods you need, and just make one of your Display
properties a tShape.

tSeat = class
private
fDisplay : tShape

public
function getSeatDisplay:tShape;

end;

tSeats = class(TComponent)
private
tSeatList : tList;
public
AddSeat(Seat:tSeat)
RemoveSeat(Seat:tSeat)
RenderSeats;
ReadSeat(Seat:tSeat);
etc...
end;


"Chris Hedges" <che...@tickets.com> wrote in message
news:3b1e6059_1@dnews...

Alberto

unread,
Jun 8, 2001, 2:36:33 PM6/8/01
to
20 to 30 seconds creating 3000-4000+ TShapes is not a long time.

If you need to display just one kind of shape, why don't you just create a
Component derived from TGraphic control. TShape is a Graphic component
derived from TGraphic Control so you can create the properties you will need
for the project and I'm pretty sure it will speed up the drawing.

"Chris Hedges" <che...@tickets.com> wrote in message
news:3b1e6059_1@dnews...

ji7k

unread,
Jun 8, 2001, 6:43:57 PM6/8/01
to
Just brainstorming so here goes . . .

How about showing one graphic representing the entire cinema or stadium.
Perhaps making it the background of a form. (A really good visual effect is
to place a panel on a main form, set the properties of the stadium form to
no headers, set the panel as the forms parent, and set align to client.
Surprisingly simple and you can call different forms to fill the panel as
needed. Look at Delphi3000 for an article on embedded forms).

Use something like mouseover and mouseclick to determine location clicked
on. I'm picturing maybe a seating chart with seats being represented in
different colors. The color of seat will determine how desireable the seat
is. Clicking on a seat will determine location by x, y coordinates, and the
color clicked on. This can be crossreferenced to a table to show if a seat
is or taken or available. If seat is taken, create a custom draw feature to
draw an X or something over the seat at that location. This should be an
overlay of the graphic and not saved to the graphic so it can be used over
and over again. If they click on an invalid color, like an aisle, an error
will occur or simply a beep. Once you get the program to correctly detect
color and coordinates your biggest problem will be creating the
cross-reference table of available seats by coordinates in a graphic. To
overcome this, create tools that takes your custom stadium graphic, scans
it, and creates the table for you. Save this table external with the same
name as the graphic and a different extension. Save seating information in
separate database file so you can track multiple events using the same
graphic/table. This way you can simply select the stadium you want want to
see, the table is loaded, taken seats are indicated, and away you go. This
cuts your program overhead way down and gives you the capability to show the
stadium as it is very quickly and perhaps have multiple stadiums able to be
displayed in there own window or tab at the same time.

HTH


0 new messages