Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 854223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:53:26+00:00 2026-05-15T07:53:26+00:00

I have a class Grid which produces a graph paper like grid on in

  • 0

I have a class Grid which produces a graph paper like grid on in the drawing area. I then have 5 other classes for different shapes to draw with; Line, Polygon, Ellipse, Curve, Arc

Now, these 5 classes use an instance of Grid because Grid has a resolution and a scale. Inside Grid I have:

public function set resolution(x:Number):void {
    _gap = (modBy10(x) / 10);
    _scale = (modBy10(x) / (this.resolution * _scale));

    draw();
}

public function get resolution():Number {
    return (_gap * 10);
}

public function set scale(x:Number):void {
    _scale = (this.resolution / x);
}

public function get scale():Number {
    return _scale;
}

/**/

public function scaleLength(x:Number):Number {
    return (x * this.scale);
}

public function scaleLengthDown(x:Number):Number {
    return (x / this.scale);
}

public function scaleArea(x:Number):Number {
    return (x / Math.pow(this.scale, 2));
}

I’m just lost for a solution on how to update every instance of my 5 drawing classes when Grid is changed.

For instance, Polygon is made up of multiple instances of Line, Line(length, angle) where “length” is in either in, ft, cm, or m. If the user wishes to change the scale from say 10ft per 100px resolution to 20ft per 80px.. Is there an easier way than re-drawing every Line inside Polygon?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T07:53:27+00:00Added an answer on May 15, 2026 at 7:53 am

    I wouldn’t have all the other objects depend on the Grid for scale.

    Rather I would have a container called something like ScaledDrawingSurface that contains all of the shape objects and the Grid object.

    The container would then have a scale propety that could be changed.

    You then have two options for dealing with a change in the scale property:

    1. Have an event that is dispatched by the ScaledDrawingSurface when the scale changes. All of the shapes and the grid would listen for this event and update themselves accordingly. If you do this, you will want to make a custom ScaleChangedEvent that includes a property for the new scale.

    2. Have the ScaledDrawingSurface iterate through all of its children setting their scales appropriately. If you do this, you will want to have an IScalable interface with a SetScale method that the shapes and the grid implement.

    In either case, you can make composite objects (e.g. polygon) responsible for updating their child objects, using either event dispatching or iterative processing.

    One nice bonus of this approach is it would be very easy to have multiple overlayed grids (like graph paper) that update to the scale of the surface – you would just need a property on the Grid class to set the spacing of each grid relative to the global scale (and probably colour and thickness properties)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSS class called grid which I place on my tables. I
I have a class which is displayed in a property grid. One of the
I have a class MinMax which among other things contains this: public class MinMax
I have some grid which use form edit. But after edit success then page
I have a grid view which is populated using a custom ImageAdapter class extending
I have: class Car {..} class Other{ List<T> GetAll(){..} } I want to do:
I have a very simple function which takes in a matching bitfield, a grid,
I have a class with various public properties which I allow users to edit
I have a class which derived from the TableLayoutPanel. This class makeup the tabel
I have a shell which looks like toolbar and defines my main region (a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.