Rectangle Question

Hi
I have a table that stores polygons that represent cities in a map. If I have a point (x,y) and I want to know in which city it is I just run this query:
select city_name
from city
where sdo_relate (geoloc, sdo_geometry (2001, 8307, sdo_point_type (x, y, null), null, null), 'mask=contains querytype=window') = 'TRUE'
and it works perfectly.
Now I have an application that shows part of the map as an image. Based on the map view boundaries (xmin, ymin, xmax, ymax) I want to know which cities I'm viewing. From what I've read I have to create a rectangle geometry for the map view and compare it to the cities polygon. So I have to run this query:
select city
from city
where sdo_relate (geoloc, sdo_geometry (2003, 8307, null, mdsys.sdo_elem_info_array (1,1003,3), mdsys.sdo_ordinate_array (xmin, ymin, xmax, ymax)), 'mask=OVERLAPBDYINTERSECT querytype=WINDOW') = 'TRUE'
But is not working. I'm getting a lot of cities that our outside the map view. I changed the mask to other setting and I'm getting the same result. What is wrong with the query?

Hi
I executed:
select geoloc
from cities
where sdo_relate (geoloc, sdo_geometry (2003, 8307, null, mdsys.sdo_elem_info_array (1,1003,3), mdsys.sdo_ordinate_array (-66.8803997725745, 10.484931517239199, -66.86210737750385, 10.502917957827096)), 'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'
SDO_GEOMETRY(2003, 8307, SDO_POINT_TYPE(-64.155181, 10.445084, NULL), SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(-64.243653, 10.500646, -64.243952, 10.388551, -64.13437, 10.388951, -64.13447, 10.416098, -64.097951, 10.416202, -64.098043, 10.44333, -64.066178, 10.443443, -64.067715, 10.501597, -64.243653, 10.500646))
SDO_GEOMETRY(2003, 8307, SDO_POINT_TYPE(-68.197494, 10.512225, NULL), SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(-68.234307, 10.471403, -68.161209, 10.471215, -68.160672, 10.553046, -68.234096, 10.5528, -68.234307, 10.471403))
SDO_GEOMETRY(2003, 8307, SDO_POINT_TYPE(-68.033341, 10.457293, NULL), SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(-68.124829, 10.416853, -67.942105, 10.416311, -67.941769, 10.524821, -68.160935, 10.525514, -68.161211, 10.471222, -68.124663, 10.471123, -68.124829, 10.416853))
SDO_GEOMETRY(2003, 8307, SDO_POINT_TYPE(-66.836154, 10.452503, NULL), SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(-67.065568, 10.413152, -66.912607, 10.4132, -66.912601, 10.376973, -66.86698, 10.37697, -66.866937, 10.383843, -66.736873, 10.382945, -66.735852, 10.518508, -66.881966, 10.519521, -66.881789, 10.546658, -67.027864, 10.547561, -67.028438, 10.493284, -67.137886, 10.493998, -67.138229, 10.439756, -67.065176, 10.439326, -67.065568, 10.413152))
SDO_GEOMETRY(2003, 8307, SDO_POINT_TYPE(-66.608378, 10.470118, NULL), SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(-66.736053, 10.491392, -66.736251, 10.46428, -66.663175, 10.463736, -66.66341, 10.436635, -66.48084, 10.435235, -66.480415, 10.489451, -66.516897, 10.489756, -66.516793, 10.503317, -66.589845, 10.503866, -66.589973, 10.490315, -66.736053, 10.491392))
SDO_GEOMETRY(2003, 8307, SDO_POINT_TYPE(-66.023725, 10.404206, NULL), SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(-66.189511, 10.351495, -66.116517, 10.350859, -66.116763, 10.323788, -66.043783, 10.323108, -66.044175, 10.268907, -65.861967, 10.26728, -65.857149, 10.534616, -66.15126, 10.540867, -66.151529, 10.513771, -66.188019, 10.514113, -66.189511, 10.351495))

Similar Messages

  • Simple rectangle question

    This should be simple to most of you but unfortunately it isnt yet to me. I'm drawing rectangles around certain areas on a map. My question is how to I make the rectangle border a little thicker. I notice a very thin border around the rectangle, but when I call a drawRect, is there a way to make the borders thicker?

    Create a new Font.
    Font font=new Font(String name,
    int style,
    int size);
    Set the new font on a graphics object.
    public void paint(Graphics g){
    g.setFont(font);
    g.drawRect(int x,int y,int width, int height);

  • Rounded Rectangles question

    I'm afraid I may know the answer to this already, but this is so fundamental I think I must be doing something wrong. In AICS3, I want to draw a rounded rectangle, but I want to control the radius of the arc defining the four corners. I'm trying to emulate an open field notebook, which has rounded corners on its pages. Illustrator seems to have a single radius, randomly chosen and consistant regardless of the size of the rectangle. I've tried double clicking the icon and get nothing. The "Transform" palette is the same as it is for all shapes: nothing but simplistic x,y inputs. (As an aside, I run into these types of problems quite a bit. The fact that AI does not draw circles and arcs has always been a problem (a circle or arc being a line controled by radius, diamter, chord, circumference or fractions thereof.)) The rounded rectangle I draw is nothing more than a rectangle with two control points at each corner. I'm hopeful there is an easy way to make those corners perfect arcs of any size by some numerical input somewhere, but I'm afraid I'm going to have to resort to my usual method: drawing it in my CAD program and importing it. Optimisim, however, rules the day today and so I'm throwing the question out there. I have CS4 access, too, so if it is possible in that version I'll switch computers for a while. Thanks in advance for any help!
    MGuilfoile

    While dragging a rounded rectangle, add the keyboard modifier of up cursor or down cursor to adjust the radius, while drawing.
    If you click once with the rounded rectangle tool and let go, you will get the dialog box.

  • All of the menus on my macbook pro how a question mark inside a rectangle.  It looks like unsupported characters.  How do I change it back to regular text?

    On my early-2011 MBP running Mavericks, all of the text of menus has turned into a question mark surrounded by a rectangle.  As a result, I cannot read any menus.  What do I do to change the character set the OS is using back to a normal charset?

    Startup in Safe Mode. http://support.apple.com/kb/PH14204
    If this does not help, reinstall OS X.
    Reinstall OS X  10.9 Mavericks
    http://support.apple.com/kb/PH13871

  • Adding a rectangle & a followup question regarding layering

    I want to simply draw a rectangle on a a location on photograph or file and just see the outline of the rectangle in a color of my choice...I dont want the rectangle filled in with the color...just the outline. I would like to have all sides of the rectangle the same width ....it would be nice to be able to determine that width if possible. What I am trying to do is to create rectangular locations on a photograph and then add text to that identified area...
    In a follow up question it appears that each time I add text from one location on the photo and go to another area to add text...a new layer appears. It would be nice to be able to add various rectangles and areas of text without having a new layer appear for each entry...is that possible?

    Use the Rectangular Marquee tool to define the rectangle. Then use the Stroke command to draw the line around it.
    You can flatten the image or merge layers, but there is no way that you can stop them being created when you create shapes or text. I don't think that being able to do so would be useful for many people.

  • Question on rectangle with graph and table

    i inserted the graph chart and table in a rectangle for similar values... but when i see the preview of this scenario... its showing seperately.... its mean that first showing the rectangle and then graph and then table in the preview page. when i saved
    it into PDF; both chart and table are coming in same rectangle.
    can any one please give a quick response to this.

    Hi  Nagalinga,
    Based on my understanding, you create a chart and table with same values, then you use a rectangle to contain them. When previewing the report, rectangle, chart, table displays separately. However, when exporting to PDF, the chart and table display in a
    same rectangle.
    In Reporting Service, rectangles can be used as containers to help control the way data regions render in a report. However, a rectangle is only a container for items that you either create in the rectangle or drag into the rectangle. If you draw a rectangle
    around an item that already exists on the design surface, the rectangle will not act as its container. So in your scenario, I suppose you create a chart and table then draw a rectangle around them, rectangle, chart and table will display separately when previewing
    report. As we tested in our environment, we create a chart and table with same values, then drag them into a rectangle, the chart and table both display in a rectangle whether we preview the report or render the report as PDF. Please refer to the screenshots
    below:
    Reference:
    Rectangles and Lines (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu

  • I have Indesign CS6.  Question is about the rectangle box on the left side.

    The rectangle/box with the X through it, on the left in the second column, does not have the X through it anymore and now when I set up something to place in that section there is no X there either.  So I kept doing my thing as usual because it was still working, but when I printed it out the outline shows up where before the X was and there was no outline that showed up.  I do not know what I hit or did to change this.

    Screen shots, please.
    There are two, similar-looking, tools in the toolbox. The ones with the X are image frame tools and expect image content by default. These do not have stroke or fill applied when created, no matter what settings might be set as defaults.
    The ones without the X are the Shape tools, and by default they expect no content, but you can place anything into them if they are empty. They will have whatever stroke and fill are set by default when created.

  • 3 questions regarding alignment, rectangle drawing, and a error I get

    3 Questions:
    ========================================
    1. Why does the DOS window in Code Warrior show this error in it, but it doesn't affect the operation of the applet?
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at PianoApplet.paint(PianoApplet.java)
    at sun.awt.RepaintArea.paint(RepaintArea.java:293)
    at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:191)
    at java.awt.Component.dispatchEventImpl(Component.java:2658)
    at java.awt.Container.dispatchEventImpl(Container.java:1208)
    at java.awt.Component.dispatchEvent(Component.java:2492)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:334)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:126)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:93)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at PianoApplet.paint(PianoApplet.java)
    at java.awt.Container.update(Container.java:976)
    at sun.awt.RepaintArea.update(RepaintArea.java:332)
    at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:195)
    at java.awt.Component.dispatchEventImpl(Component.java:2658)
    at java.awt.Container.dispatchEventImpl(Container.java:1208)
    at java.awt.Component.dispatchEvent(Component.java:2492)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:334)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:126)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:93)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)
    ===========================================
    Second Question
    How do I align this so that it is is on the right on the applet, cause it overlaps my keyboard when I just place it.
    private TextArea intro = new TextArea("Welcome to the PianoApplet! \nHere you will be able to play a full sized octave of keys. \nClick a key to play the key. \nYou can also drag your mouse across the keyboard \nand play multiple notes at once.", 5, 40);
    ===========================================
    Third Question
    When I do this:
    if(state.equals("duh")){
    g.setColor(Color.green);
    g.fillRect(150,50,40,90);
    g.drawImage(iduh,100, 200, this);
    It colors everything green, not just the duh key, it also colors the duh sharp, reh, and half the reh sharp. Why is that?
    =========================================
    Please answer any of my questions.
    Thanks.
    ==========
    My Code
    ==========
    import java.awt.*;
    import java.applet.Applet;
    import javax.swing.*;
    import java.awt.event.*;
    import java.applet.AudioClip;
    public class PianoApplet extends Applet implements MouseListener, MouseMotionListener {
    private Point mouse = new Point();
    //private TextField output=new TextField(30);
    //private TextArea intro = new TextArea("Welcome to the PianoApplet! \nHere you will be able to play a full sized octave of keys. \nClick a key to play the key. \nYou can also drag your mouse across the keyboard \nand play multiple notes at once.", 5, 40);
    private String state = null;
    //The images
    private Image iduh, ire, ime, ifa, isol, ila, isi, iduh2, iduhsharp, iemptynotes, ifasharp, ilasharp, iresharp, isolsharp;
    //The sounds
    AudioClip duh;
    AudioClip re;
    AudioClip me;
    AudioClip fa;
    AudioClip sol;
    AudioClip la;
    AudioClip si;
    AudioClip duh2;
    AudioClip b0;
    AudioClip b1;
    AudioClip b2;
    AudioClip b3;
    AudioClip b4;
    public void init(){
    //load images of notes here
    iduh = getImage(getCodeBase(), "duh.jpg");
    ire = getImage(getCodeBase(), "re.jpg");
    ime = getImage(getCodeBase(), "me.jpg");
    ifa = getImage(getCodeBase(), "fa.jpg");
    isol = getImage(getCodeBase(), "sol.jpg");
    ila = getImage(getCodeBase(), "la.jpg");
    isi = getImage(getCodeBase(), "si.jpg");
    iduh2 = getImage(getCodeBase(), "duh2.jpg");
    iduhsharp = getImage(getCodeBase(), "duhsharp.jpg");
    iemptynotes = getImage(getCodeBase(), "emptynotes.jpg");
    ifasharp = getImage(getCodeBase(), "fasharp.jpg");
    ilasharp = getImage(getCodeBase(), "lasharp.jpg");
    iresharp = getImage(getCodeBase(), "resharp.jpg");
    isolsharp = getImage(getCodeBase(), "solsharp.jpg");
    //load sounds of piano here
    duh = getAudioClip(getCodeBase(),"duh.au");
    re = getAudioClip(getCodeBase(),"re.au");
    me = getAudioClip(getCodeBase(),"me.au");
    fa = getAudioClip(getCodeBase(),"fa.au");
    sol = getAudioClip(getCodeBase(),"sol.au");
    la = getAudioClip(getCodeBase(),"la.au");
    si = getAudioClip(getCodeBase(),"si.au");
    duh2 = getAudioClip(getCodeBase(),"duh2.au");
    b0 = getAudioClip(getCodeBase(),"b0.au");
    b1 = getAudioClip(getCodeBase(),"b1.au");
    b2 = getAudioClip(getCodeBase(),"b2.au");
    b3 = getAudioClip(getCodeBase(),"b3.au");
    b4 = getAudioClip(getCodeBase(),"b4.au");
    addMouseListener(this);
    addMouseMotionListener(this);
    //add(output);
    setSize(750,300);
    //add(intro);
    public void paint(Graphics g) {
    g.setColor(Color.black);
    g.drawRect(150,50,40,90); g.fillRect(165,50,12,60);
    g.drawRect(170,50,40,90);
    g.fillRect(185,50,12,60);
    g.drawRect(190,50,40,90);
    g.drawRect(210,50,40,90);
    g.fillRect(225,50,12,60);
    g.drawRect(230,50,40,90);
    g.fillRect(245,50,12,60);
    g.drawRect(250,50,40,90);
    g.fillRect(265,50,12,60);
    g.drawRect(270,50,40,90);
    g.drawImage(iemptynotes,100, 200, this);
    if(state.equals("duh")){
    g.setColor(Color.green);
    g.fillRect(150,50,40,90);
    g.drawImage(iduh,100, 200, this);
    if(state.equals("re")){
    g.drawImage(ire,100, 200, this);
    if(state.equals("me")){
    g.drawImage(ime,100, 200, this);
    if(state.equals("fa")){
    g.drawImage(ifa,100, 200, this);
    if(state.equals("sol")){
    g.drawImage(isol,100, 200, this);
    if(state.equals("la")){
    g.drawImage(ila,100, 200, this);
    if(state.equals("si")){
    g.drawImage(isi,100, 200, this);
    if(state.equals("duh2")){
    g.drawImage(iduh2,100, 200, this);
    if(state.equals("b0")){
    g.drawImage(iduhsharp,100, 200, this);
    if(state.equals("b2")){
    g.drawImage(ifasharp,100, 200, this);
    if(state.equals("b4")){
    g.drawImage(ilasharp,100, 200, this);
    if(state.equals("b1")){
    g.drawImage(iresharp,100, 200, this);
    if(state.equals("b3")){
    g.drawImage(isolsharp,100, 200, this);
    public void mouseClicked(MouseEvent e){
    mouse = e.getPoint();
    //output.setText("x: " + mouse.x + " y: " + mouse.y);
    repaint();
    if (((50<mouse.y && mouse.y<110) && (150<mouse.x && mouse.x<165)) || ((110<mouse.y && mouse.y<140) && (150<mouse.x && mouse.x<170)))
    //setBackground(Color.green);
    duh.play();
    state = "duh";
    repaint();
    System.out.println("Duh");
    else if (((50<mouse.y && mouse.y<110) && (165<mouse.x && mouse.x<175)))
    b0.play();
    state = "b0";
    repaint();
    System.out.println("b0");
    else if (((50<mouse.y && mouse.y<110) && (175<mouse.x && mouse.x<185)) || ((110<mouse.y && mouse.y<140) && (170<mouse.x && mouse.x<190)))
    re.play();
    state = "re";
    repaint();
    System.out.println("reh");
    else if (((50<mouse.y && mouse.y<110) && (185<mouse.x && mouse.x<195)))
    b1.play();
    state = "b1";
    repaint();
    System.out.println("b1");
    else if (((50<mouse.y && mouse.y<110) && (195<mouse.x && mouse.x<210)) || ((110<mouse.y && mouse.y<140) && (190<mouse.x && mouse.x<210)))
    me.play();
    state = "me";
    repaint();
    System.out.println("me");
    else if (((50<mouse.y && mouse.y<110) && (210<mouse.x && mouse.x<225)) || ((110<mouse.y && mouse.y<140) && (210<mouse.x && mouse.x<230)))
    fa.play();
    state = "fa";
    repaint();
    System.out.println("fa");
    else if (((50<mouse.y && mouse.y<110) && (225<mouse.x && mouse.x<235)))
    b2.play();
    state = "b2";
    repaint();
    System.out.println("b2");
    else if (((50<mouse.y && mouse.y<110) && (235<mouse.x && mouse.x<245)) || ((110<mouse.y && mouse.y<140) && (235<mouse.x && mouse.x<250)))
    sol.play();
    state = "sol";
    repaint();
    System.out.println("sol");
    else if (((50<mouse.y && mouse.y<110) && (245<mouse.x && mouse.x<255)))
    b3.play();
    state = "b3";
    repaint();
    System.out.println("b3");
    else if (((50<mouse.y && mouse.y<110) && (255<mouse.x && mouse.x<265)) || ((110<mouse.y && mouse.y<140) && (255<mouse.x && mouse.x<270)))
    la.play();
    state = "la";
    repaint();
    System.out.println("la");
    else if (((50<mouse.y && mouse.y<110) && (265<mouse.x && mouse.x<275)))
    b4.play();
    state = "b4";
    repaint();
    System.out.println("b4");
    else if (((50<mouse.y && mouse.y<110) && (275<mouse.x && mouse.x<290)) || ((110<mouse.y && mouse.y<140) && (270<mouse.x && mouse.x<290)))
    si.play();
    state = "si";
    repaint();
    System.out.println("si");
    else if (((50<mouse.y && mouse.y<140) && (290<mouse.x && mouse.x<310)))
    duh2.play();
    state = "duh2";
    repaint();
    System.out.println("duh");
    public void mouseDragged(MouseEvent e) {
    //output.setText("x: " + mouse.x + " y: " + mouse.y);
    mouse = e.getPoint();
    repaint();
    if (((50<mouse.y && mouse.y<110) && (150<mouse.x && mouse.x<165)) || ((110<mouse.y && mouse.y<140) && (150<mouse.x && mouse.x<170)))
    //setBackground(Color.green);
    duh.play();
    state = "duh";
    repaint();
    System.out.println("Duh");
    else if (((50<mouse.y && mouse.y<110) && (165<mouse.x && mouse.x<175)))
    b0.play();
    state = "b0";
    repaint();
    System.out.println("b0");
    else if (((50<mouse.y && mouse.y<110) && (175<mouse.x && mouse.x<185)) || ((110<mouse.y && mouse.y<140) && (170<mouse.x && mouse.x<190)))
    re.play();
    state = "re";
    repaint();
    System.out.println("reh");
    else if (((50<mouse.y && mouse.y<110) && (185<mouse.x && mouse.x<195)))
    b1.play();
    state = "b1";
    repaint();
    System.out.println("b1");
    else if (((50<mouse.y && mouse.y<110) && (195<mouse.x && mouse.x<210)) || ((110<mouse.y && mouse.y<140) && (190<mouse.x && mouse.x<210)))
    me.play();
    state = "me";
    repaint();
    System.out.println("me");
    else if (((50<mouse.y && mouse.y<110) && (210<mouse.x && mouse.x<225)) || ((110<mouse.y && mouse.y<140) && (210<mouse.x && mouse.x<230)))
    fa.play();
    state = "fa";
    repaint();
    System.out.println("fa");
    else if (((50<mouse.y && mouse.y<110) && (225<mouse.x && mouse.x<235)))
    b2.play();
    state = "b2";
    repaint();
    System.out.println("b2");
    else if (((50<mouse.y && mouse.y<110) && (235<mouse.x && mouse.x<245)) || ((110<mouse.y && mouse.y<140) && (235<mouse.x && mouse.x<250)))
    sol.play();
    state = "sol";
    repaint();
    System.out.println("sol");
    else if (((50<mouse.y && mouse.y<110) && (245<mouse.x && mouse.x<255)))
    b3.play();
    state = "b3";
    repaint();
    System.out.println("b3");
    else if (((50<mouse.y && mouse.y<110) && (255<mouse.x && mouse.x<265)) || ((110<mouse.y && mouse.y<140) && (255<mouse.x && mouse.x<270)))
    la.play();
    state = "la";
    repaint();
    System.out.println("la");
    else if (((50<mouse.y && mouse.y<110) && (265<mouse.x && mouse.x<275)))
    b4.play();
    state = "b4";
    repaint();
    System.out.println("b4");
    else if (((50<mouse.y && mouse.y<110) && (275<mouse.x && mouse.x<290)) || ((110<mouse.y && mouse.y<140) && (270<mouse.x && mouse.x<290)))
    si.play();
    state = "si";
    repaint();
    System.out.println("si");
    else if (((50<mouse.y && mouse.y<140) && (290<mouse.x && mouse.x<310)))
    duh2.play();
    state = "duh2";
    repaint();
    System.out.println("duh");
    public void mouseEntered(MouseEvent e){ }
    public void mouseExited(MouseEvent e){ }
    public void mousePressed(MouseEvent e){ }
    public void mouseReleased(MouseEvent e){ }
    public void mouseMoved(MouseEvent e){ }
    }

    question 2:
    BFI answer:
    put everything you have in a panel
    put your text area beside it.
    question 1:
    something about painting a .java file just seems wrong.
    question 3:
    because you told it to.

  • How can I get  the part image from a rectangle region?

    hi,
    I'm trying to draw a rectagle region on a picture with mouse and crop it. but the rectangle is not vertical along x-axis.that is to say, there is a angle between x-axis and the base of the rectangle. I don't know , how can I do it. Can someone give me some tip or some java-code. Thank you very much in advance.

    I completely misunderstood your question. As I read it again it seems clear and straight-forward. I'm sorry. Let's see if this is closer.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import java.net.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    public class CropImage
        BufferedImage original;
        CropPanel cropPanel;
        CropSelector selector;
        public CropImage()
            original = getImage();
            cropPanel = new CropPanel(original);
            selector = new CropSelector(cropPanel);
            cropPanel.addMouseListener(selector);
            cropPanel.addMouseMotionListener(selector);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(getUIPanel(), "North");
            f.getContentPane().add(new JScrollPane(cropPanel));
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
        private BufferedImage getImage()
            String fileName = "images/coyote.jpg";
            BufferedImage image = null;
            try
                URL url = getClass().getResource(fileName);
                image = ImageIO.read(url);
            catch(MalformedURLException mue)
                System.err.println("url: " + mue.getMessage());
            catch(IOException ioe)
                System.err.println("read: " + ioe.getMessage());
            return image;
        private JPanel getUIPanel()
            final JButton
                mask    = new JButton("mask"),
                crop    = new JButton("crop"),
                restore = new JButton("restore");
            ActionListener l = new ActionListener()
                public void actionPerformed(ActionEvent e)
                    JButton button = (JButton)e.getSource();
                    if(button == mask)
                        selector.mask();
                    if(button == crop)
                        selector.crop();
                    if(button == restore)
                        cropPanel.restore(original);
            mask.addActionListener(l);
            crop.addActionListener(l);
            restore.addActionListener(l);
            JPanel panel = new JPanel();
            panel.add(mask);
            panel.add(crop);
            panel.add(restore);
            return panel;
        public static void main(String[] args)
            new CropImage();
    class CropPanel extends JPanel
        BufferedImage image;
        Dimension size;
        GeneralPath clip;
        Point[] corners;
        Area mask;
        boolean showMask;
        Color bgColor;
        public CropPanel(BufferedImage bi)
            image = bi;
            setSize();
            clip = new GeneralPath();
            showMask = false;
            bgColor = getBackground();
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int w = getWidth();
            int h = getHeight();
            int x = (w - size.width)/2;
            int y = (h - size.height)/2;
            g2.drawImage(image, x, y, this);
            if(showMask)
                g2.setPaint(getBackground());
                g2.fill(mask);
            else
                g2.setPaint(Color.red);
                g2.draw(clip);
        public Dimension getPreferredSize()
            return size;
        public void setClip(Point[] p)
            corners = p;
            clip.reset();
            clip.moveTo(p[0].x, p[0].y);
            clip.lineTo(p[1].x, p[1].y);
            clip.lineTo(p[2].x, p[2].y);
            clip.lineTo(p[3].x, p[3].y);
            clip.closePath();
            repaint();
        public void clearClip()
            clip.reset();
            repaint();
        public void setMask(Area area)
            mask = area;
            showMask = true;
            repaint();
        public void setImage(BufferedImage image)
            this.image = image;
            setSize();
            showMask = false;
            clip.reset();
            repaint();
            revalidate();
        public void restore(BufferedImage image)
            setBackground(bgColor);
            setImage(image);
        private void setSize()
            size = new Dimension(image.getWidth(), image.getHeight());
    class CropSelector extends MouseInputAdapter
        CropPanel cropPanel;
        Point start, end;
        public CropSelector(CropPanel cp)
            cropPanel = cp;
        public void mask()
            Dimension d = cropPanel.getSize();
            Rectangle r = new Rectangle(0, 0, d.width, d.height);
            Area mask = new Area(r);
            Area port = new Area(cropPanel.clip);
            mask.subtract(port);
            cropPanel.setMask(mask);
        public void crop()
            Point[] p = cropPanel.corners;
            int w = p[2].x - p[0].x;
            int h = p[1].y - p[3].y;
            BufferedImage cropped = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
            Graphics2D g2 = cropped.createGraphics();
            g2.translate(-p[0].x, -p[3].y);
            cropPanel.paint(g2);
            g2.dispose();
            cropPanel.setBackground(Color.pink);
            cropPanel.setImage(cropped);
        public void mousePressed(MouseEvent e)
            if(e.getClickCount() == 2)
                cropPanel.clearClip();
            start = e.getPoint();
        public void mouseDragged(MouseEvent e)
            end = e.getPoint();
            // locate high and low points of rectangle from start
            int dy = end.y - start.y;
            int dx = end.x - start.x;
            double theta = Math.atan2(dy, dx);
            double spoke = start.distance(end)/2;
            double side = Math.sqrt(spoke*spoke + spoke*spoke);
            Point[] corners = new Point[4];           // counter-clockwise
            corners[0] = start;                       // left
            int x = (int)(start.x + side * Math.cos(theta + Math.PI/4));
            int y = (int)(start.y + side * Math.sin(theta + Math.PI/4));
            corners[1] = new Point(x, y);             // bottom
            corners[2] = end;                         // right
            x = (int)(start.x + side * Math.cos(theta - Math.PI/4));
            y = (int)(start.y + side * Math.sin(theta - Math.PI/4));
            corners[3] = new Point(x, y);             // top
            cropPanel.setClip(corners);
    }

  • I am trying to export a Pages document to a pdf, and a tiny black rectangle with a small white circle keeps showing up. I can't seem to delete it in my pages document. help!

    I am using Pages, 5.2.2., on a MacBook Air, system 10.9.5., and I have a formatting question. I am making a small brochure, and it seems like in some places for reasons unknown, when I have a return, there's a small black-filled rectangle, about the size of one letter, with a small white circle inside of it appearing. I want to get rid of that little symbol. I keep trying to press delete, but then I lose my return/spacing. (Can you tell I'm a brute beginner?) Help! And thanks!

    It sounds like you are using a Chinese font.
    Use something else eg Times or Helvetica or any European font.
    If the character disappears, its the font.
    Peter

  • Follow up on 4x6 Question

    Thanks again Beverly, your suggestions solved my print problem. However, the picture was slightly cropped at the top and it also had 2 very small borders on the left and right, being printed in landscape.
    In Page Set Up I wanted a vertical print not a landscape print. In PSU I highlighted the verticle icon. Are these two items more to do with iPhoto itself or the printer instructions? I have a new Epson CX6000 printer. Their manual does not address the problem that you answered. I have an email into them, but who knows when they will answer.
    An Addendum to the previous Post: The Print window does not show paper as an option per se. The paper option appears under Presets. Photos per page doesn't show, perhaps because I only want to print one picture.
    Thanks again for the help
    John

    Hi, John. I can address one of your questions here.
    However, the picture was slightly cropped at the top and it also had 2 very small borders on the left and right, being printed in landscape.
    A standard digital camera image is proportioned 4:3 (1.33:1). That doesn't match the 6:4 ratio of your paper's dimensions (1.5:1), so unless you opt either to distort the image or crop it, it can't be an exact fit on the paper.
    In the toolbar at the top of iPhoto's Edit view is a pull-down menu above the word "Constrain". You use that menu to specify standard proportions for printing the image. Select "4x6 (Postcard)", and you will see superimposed on the picture a rectangle that has those proportions. What's inside the rectangle looks normal, signifying that it will be printed; what's outside the rectangle is pale and muted, because it will be cropped away when you print. Place your cursor anywhere inside the rectangle, hold the mouse button down and drag, to move the rectangle and change what's included within the print boundary.
    The fact that your printed picture was both cropped and slightly reduced in size (creating the small left and right borders) suggests to me that your printer may not be capable of borderless printing, or that there is a setting for borderless prints you're overlooking somewhere. Since the contents of both the Print and Page Setup dialog boxes are governed by the printer's own driver software, and there's no "borderless" setting anywhere within iPhoto, I think you'll need to review the printer's documentation and/or online help files carefully to see whether you're overlooking something in one of those dialog boxes.

  • Very simple question-how to fill a shape I draw with color

    hi. I am new to photoshop and having a lot of trouble selecting any shape that I draw. I am trying to do a tutorial that involves filling a canvas with gray, then drawing a smaller white rectangle inside of the larger gray canvas/rectangle. (I did not forget to unlock the background).
    My question: how do i select and fill (with white) the second rectangle I draw on top of the larger gray rectangle???
    In general, I cannot figure out how to select and/or fill any shape I draw using the rectangle tool. Likewise, the marque shape tools are no help as I cannot seem to draw a marque on my gray rectangle in order to select it and fill it with a white fill. I have also tried to use a "fill layer."
    I am almost certain that something is wrong with my computer(I reset the settings), but then again I have not used photoshop in over a year. Any help  will be greatly appreciated.

    The Rectangle Tool sgould create a Work Path, Shape Layer or Fill Pixels according to the Settings in the Options Bar.
    The Rectangular Marquee Tool should create a Selection, which you could Edit > Fill or use as a Layer Mask for a Solid Color Layer.
    Could you please post a screenshot with the pertinent Panels visible?

  • Compiled Error in Xcode for iphone game and other questions

    Dear all,
    Hi, I am a newbie of xcode and objective-c and I have a few questions regarding to the code sample of a game attached below. It is written in objective C, Xcode for iphone4 simulator. It is part of the code of 'ball bounce against brick" game. Instead of creating the image by IB, the code supposes to create (programmatically) 5 X 4 bricks using 4 different kinds of bricks pictures (bricktype1.png...). I have the bricks defined in .h file properly and method written in .m.
    My questions are for the following code:
    - (void)initializeBricks
    brickTypes[0] = @"bricktype1.png";
    brickTypes[1] = @"bricktype2.png";
    brickTypes[2] = @"bricktype3.png";
    brickTypes[3] = @"bricktype4.png";
    int count = 0;`
    for (int y = 0; y < BRICKS_HEIGHT; y++)
    for (int x = 0; x < BRICKS_WIDTH; x++)
    - Line1 UIImage *image = [ImageCache loadImage:brickTypes[count++ % 4]];
    - Line2 bricks[x][y] = [[[UIImageView alloc] initWithImage:image] autorelease];
    - Line3 CGRect newFrame = bricks[x][y].frame;
    - Line4 newFrame.origin = CGPointMake(x * 64, (y * 40) + 50);
    - Line5 bricks[x][y].frame = newFrame;
    - Line6 [self.view addSubview:bricks[x][y]]
    1) When it is compiled, error "ImageCache undeclared" in Line 1. But I have already added the png to the project. What is the problem and how to fix it? (If possible, please suggest code and explain what it does and where to put it.)
    2) How does the following in Line 1 work? Does it assign the element (name of .png) of brickType to image?
    brickTypes[count ++ % 4]
    For instance, returns one of the file name bricktype1.png to the image object? If true, what is the max value of "count", ends at 5? (as X increments 5 times for each Y). But then "count" will exceed the max 'index value' of brickTypes which is 3!
    3) In Line2, does the image object which is being allocated has a name and linked with the .png already at this line *before* it is assigned to brick[x][y]?
    4) What do Line3 and Line5 do? Why newFrame on left in line3 but appears on right in Line5?
    5) What does Line 4 do?
    Thanks
    North

    Hi North -
    macbie wrote:
    1) When it is compiled, error "ImageCache undeclared" in Line 1. ...
    UIImage *image = [ImageCache loadImage:brickTypes[count++ % 4]]; // Line 1
    The compiler is telling you it doesn't know what ImageCache refers to. Is ImageCache the name of a custom class? In that case you may have omitted #import "ImageCache.h". Else if ImageCache refers to an instance of some class, where is that declaration made? I can't tell you how to code the missing piece(s) because I can't guess the answers to these questions.
    Btw, if the png file images were already the correct size, it looks like you could substitute this for Line 1:
    UIImage *image = [UIImage imageNamed:brickTypes[count++ % 4]]; // Line 1
    2) How does the following in Line 1 work? Does it assign the element (name of .png) of brickType to image?
    brickTypes[count ++ % 4]
    Though you don't show the declaration of brickTypes, it appears to be a "C" array of NSString object pointers. Thus brickTypes[0] is the first string, and brickTypes[3] is the last string.
    The expression (count++ % 4) does two things. Firstly, the trailing ++ operator means the variable 'count' will be incremented as soon as the current expression is evaluated. Thus 'count' is zero (its initial value) the first time through the inner loop, its value is one the second time, and two the third time. The following two code blocks do exactly the same thing::
    int index = 0;
    NSString *filename = brickTypes[index++];
    int index = 0;
    NSString *filename = brickTypes[index];
    index = index + 1;
    The percent sign is the "modulus operator" so x%4 means "x modulo 4", which evaluates to the remainder after x is divided by 4. If x starts at 0, and is incremented once everytime through a loop, we'll get the following sequence of values for x%4: 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, ...
    So repeated evaluation of (brickTypes[count++ % 4]) produces the sequence: @"bricktype1.png", @"bricktype2.png", @"bricktype3.png", @"bricktype4.png", @"bricktype1.png", @"bricktype2.png", @"bricktype3.png", @"bricktype4.png", @"bricktype1.png", @"bricktype2.png", ...
    3) In Line2, does the image object which is being allocated has a name and linked with the .png already at this line *before* it is assigned to brick[x][y]?
    Line 2 allocs an object of type UIImageView and specifies the data at 'image' as the picture to be displayed by the new object. Since we immediately assign the address of the new UIImageView object to an element of the 'bricks' array, that address isn't stored in any named variable.
    The new UIImageView object is not associated with the name of the png file from which its picture originated. In fact the UIImage object which inited the UIImageView object is also not associated with that png filename. In other words, once a UIImage object is initialized from the contents of an image file, it's not possible to obtain the name of that file from the UIImage object. Note when you add a png media object to a UIImageView object in IB, the filename of the png resource will be retained and used to identify the image view object. But AFAIK, unless you explicitly save it somewhere in your code, that filename will not be available at run time.
    4) What do Line3 and Line5 do? Why newFrame on left in line3 but appears on right in Line5?
    5) What does Line 4 do?
    In Line 2 we've set the current element of 'bricks' to the address of a new UIImageView object which will display one of the 4 brick types. By default, the frame of a UIImageView object is set to the size of the image which initialized it. So after Line 2, we know that frame.size for the current array element is correct (assuming the image size of the original png file was what we want to display, or assuming that the purpose of [ImageCache loadImage:...] is to adjust the png size).
    Then in Line 3, we set the rectangle named newFrame to the frame of the current array element, i.e. to the frame of the UIImageView object whose address is stored in the current array element. So now we have a rectangle whose size (width, height) is correct for the image to be displayed. But where will this rectangle be placed on the superview? The placement of this rectangle is determined by its origin.
    Line 4 computes the origin we want. Now we have a rectangle with both the correct size and the correct origin.
    Line 5 sets the frame of the new UIImageView object to the rectangle we constructed in Lines 3 and 4. When that object is then added to the superview in Line 6, it will display an image of the correct size at the correct position.
    - Ray

  • SSRS : Performance related question

    Hi Frineds,
    I have below scenario
    I have one master Driver report (rdl) which has 7 sub reports. I have put expression on the visibility of those reports.
    well reports are running slow.
    Example of one sub report:: in this i have one big rectangle, in that rectangle i have different regular stuff(tablix, textboxes and images).
    Instead of 7 sub reports i can take 7 big rectangle and put the similar expressiion on the visibility of those big rectangles.
    the benefit is, there will be only one report(the master driver report dont need to call any report).
    The question is,
    Will this new approach gives any performance benefit ???
    Thanks In advance,
    Parixitsinh

    Hi Parixitsinh,
    In Reporting Services, each subreport instance is a separate query execution and a separate report processing task. So there are some advantages and disadvantages of using subreports within performance issue. The details information is shown below:
    Do use subreports when there are just a few subreport instances.
    Do not use subreports inside a group when there are many group instances. For example, to display a list of both sales and returns for each customer, consider using drillthrough reports. Consider whether you can write the query to join the customer with
    sales and returns and then group by the customer ID.
    Do use subreports when the subreport uses a different data source than the main report. If performance is an issue, consider changing the dataset query in the main report by using one of the following mitigation strategies:
    • Collect data in a data warehouse and use the data warehouse as a data source for a single dataset.
    • Use SQL Server linked servers and write a query that retrieves data from multiple databases.
    • Use the OPEN ROWSET capability to specify different databases.
    For more information about the report performance, we can refer to the following document:
    http://technet.microsoft.com/en-us/library/bb522806(v=sql.105).aspx
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Ssrs 2008 r2 rectangle causes first page to be blank

    In an SSRS 2008 r2 report I have 6 matrixes that I placed into 1 rectangle so that all the individual items do not float.
    The problem is that the first page of the ssrs 2008 r2 report is blank when the report is executing.
    I have set the report properties to: landscape, custom paper size, width 14" and height = 11". The report properties are width 14 inches and the height is 11 inches. The body properties keep changing to 26.75719 inches and width = 13.54667 inches.
    When I set the border of the rectangle to solid,  I can see the rectangle when the SSRS report is executing. The rectangle appears before any of the matrixes are displayed. However when I look at the rectangle in design mode, the rectangle is around all
    6 of the matrixes.
    Thus could you tell me why the rectangle is displayed in a different location when the report is executing and not around all the matrixes at that point?
    If there is no property that can be set, then should I have more than one rectangle? To place the objects into separate rectangles, I want to mention that that there is a header matrix and a summary rectangle that need to be shared. Matrix #2 and Matrix #3
    are for students in grades 01 to 08. Matrix #4 and #5 are for students in grades 09 to 12.
    Can you tell me what I can do so that I do not have a blank first page when the SSRS 2008 R2 report is executing?

    Hi wendy,
    If we want to use a rectangle as a container for other items, we should drag them into the rectangle. When we move the rectangle, the items that are contained within the rectangle move along with it. An item within the rectangle shows the name
    of the rectangle in its Parent property.
    For more information about using a rectangle as a container, please see:
    Add a Rectangle or Container (Report Builder and SSRS)
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

Maybe you are looking for

  • Performance issue related to BSIS table:pls help

    Theres a select statement which fetches data from BSIS table. As in the where clause the only key field used is BUKRS its consuming more time.Below is the code. Could you please tell me how to improvise this piece of code. I tried to fecth first from

  • How to make Recipient field as mandatory in MB21 transaction ?

    I ve got  a requirement to make the Recipient Field in MB21 transaction as mandatory... pls suggest how to do... thks in advance... Edited by: mythili on May 5, 2009 12:30 PM

  • [SOLVED] ssh-agent support removed from kde-agent

    Hi all, Since its upgrade yesterday, kde-agent does not support ssh-agent anymore (see here). I consequently can't store unlocked SSH keys anymore, because ssh-add from a konsole can't connect to ssh-agent. The update note above mentions that the SSH

  • Concurrent Program ends in Error without any error message - Apps 11.0.3

    Hi, We have a concurrent program which errors out sometimes without any error message in log file or anywhere else. This happens intermittently. Is there anyway to see why this happens ( to see error message somewhere else - like FND tables ?). Any f

  • Cant send emails

    I was able to send emails but now it doesnt let me so i tried re-adding the email address and this came up The SMTP server "smtp.charter.net" is not responding. Try checking the network connection, and that the server name is correct. Otherwise, the