The Java list<object> How to determine the element category, the fallback of the input stream, and the coordinate transformation of the reference block in AutoCAD.

Source: Internet
Author: User

A little summary of recent projects related to CAD data

1. About list<object> usage in Java.

It can save a number of different elements, but how do you determine what kind of element it is when you take an element? When you take an element, you can determine what type of element is in the list by calling the GetClass method and comparing it to the class. The element is then coerced into a type cast.


2. Reference block coordinates for data in AutoCAD.

A block reference in a DXF file has a definition of coordinates that can be inserted into an entity segment to insert these reference blocks. But the coordinates of the insertion point are only in the insert, so how do you determine the coordinates of the elements of the reference block? And what does the insertion point mean?

The law is explored by calculating coordinates: the first insertion point is the position of the coordinate origin (0,0) in the reference block after the insert. In this way, the coordinates of the elements of the reference block after insertion can be determined by calculating the relative relationship of the points to the origin of the coordinates. Specifically, the code for scaling, rotating, and other axes of each axis is as follows:


3. Read about the Bufferreader stream in Java. If it is read, it is checked for not the desired data, but it cannot be simply discarded because the code that might be followed is needed. It means that the data is read out and then put back. What do you do?

Mark the previous position by calling the mark () method, and then retreat back to the position of the last mark-marked stream by calling the Reset () method. (here to take full account of the situation, do not because Mark's place is not enough or wrong, causing the cycle of death.) This should be related to the tag stream position variable in the buffer data structure of the file.


The Java list<object> How to determine the element category, the fallback of the input stream, and the coordinate transformation of the reference block in AutoCAD.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.