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

  • SEARCH
  • Home
  • 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 8952851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:57:54+00:00 2026-06-15T13:57:54+00:00

i have got an own vector.class and a polygon.class Vector.class package org.onvif.ver10.schema; import javax.xml.bind.annotation.XmlAccessType;

  • 0

i have got an own vector.class and a polygon.class
Vector.class

package org.onvif.ver10.schema;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;

@XmlAccessorType(XmlAccessType.FIELD)

@XmlType(name = "Vector")

public class Vector {

    @XmlAttribute(name = "x")
    protected Float x;
    @XmlAttribute(name = "y")
    protected Float y;

    /**
     * Gets the value of the x property.
     * 
     * @return
     *     possible object is
     *     {@link Float }
     *     
     */
    public Float getX() {
        return x;
    }

    /**
     * Sets the value of the x property.
     * 
     * @param value
     *     allowed object is
     *     {@link Float }
     *     
     */
    public void setX(Float value) {
        this.x = value;
    }

    /**
     * Gets the value of the y property.
     * 
     * @return
     *     possible object is
     *     {@link Float }
     *     
     */
    public Float getY() {
        return y;
    }

    /**
     * Sets the value of the y property.
     * 
     * @param value
     *     allowed object is
     *     {@link Float }
     *     
     */
    public void setY(Float value) {
        this.y = value;
    }
    }

and the polygon class

public class Polygon {

@XmlElement(name = "Point", required = true)
protected List<Vector> point;

/**
 * Gets the value of the point property.
 * 
 * <p>
 * This accessor method returns a reference to the live list,
 * not a snapshot. Therefore any modification you make to the
 * returned list will be present inside the JAXB object.
 * This is why there is not a <CODE>set</CODE> method for the point property.
 * 
 * <p>
 * For example, to add a new item, do as follows:
 * <pre>
 *    getPoint().add(newItem);
 * </pre>
 * 
 * 
 * <p>
 * Objects of the following type(s) are allowed in the list
 * {@link Vector }
 * 
 * 
 */
public List<Vector> getPoint() {
    if (point == null) {
        point = new ArrayList<Vector>();
    }
    return this.point;
}

}

So, i give the vector elements:

org.onvif.ver10.schema.Vector MyVector = new Vector(); // létrehozzuk az
                                                                // onvif féle
                                                                // vector-t
        org.onvif.ver10.schema.Polygon op = new org.onvif.ver10.schema.Polygon();

        for (int i = 1; i <= p.npoints; i++) {
//          IJ.log("X: "+ i);
//          MyVector.setX((float) p.xpoints[i]); // hozzáadjuk az elemet
//          MyVector.setY((float) p.ypoints[i]);

            MyVector.setX((float)p.xpoints[i-1]);
            op.getPoint().add(MyVector);
            IJ.log("Vector X Elements "+i+" :"+ MyVector.getX());

        }
        IJ.log("Op size " + op.getPoint().size());

My question is how can i get the op (onvif polygon) elements?
Because i no matter how i try i just got the last element 10 times.

  • 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-06-15T13:57:55+00:00Added an answer on June 15, 2026 at 1:57 pm

    Your bug is that you are adding the same Vector instance to the polygon 10 times and setting the points on that one instance over and over.

    Your code should be changed to move the new Vector() line inside the loop:

        org.onvif.ver10.schema.Polygon op = new org.onvif.ver10.schema.Polygon();
    
        for (int i = 1; i <= p.npoints; i++) {
            org.onvif.ver10.schema.Vector MyVector = new Vector(); 
            MyVector.setX((float)p.xpoints[i-1]);
            op.getPoint().add(MyVector);
            IJ.log("Vector X Elements "+i+" :"+ MyVector.getX());
    
        }
    

    Style issues with your code include, but are not limited to:

    • Variable names should start with a lowercase letter, so myVector not MyVector
    • Never create class names synonymous with JDK classes (like Vector)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got my own JAR () running via separated class loaders and one
I have a BufferedImage displayed in a JFrame through my own class. I opted
i have got third polling scripts which has it's own admin panel, i want
I have got a C# user control, which has got it's own background worker
I am working on my own graph drawing application. I have got the graph
I made my own class template to maintain pair of elements of any type
I have got a server that controls a complicated industrial system. We need to
I wanna start with first program in PHP. I have got installed xampp and
I have got some issues using the DAGLayout algorithm of JUNG and subsequently reading
I have got hold of a sql server 2008 developer edition and this is

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.