...
The most important step is to embed the viewer object and connect it with the host application. The viewer object com.graebert.aresinstance.CFxARESDocumentView can be used and configured in a layout file. The next step is to bind the layout object with a property of type CFxARESDocumentView using findViewById(). This object is a member of the host application. The host application is connected to application’s main class is the MainActivity.java that has a synergy with a class named ARESDelegate.java extended by CFxARESInstanceDelegate and is . The ARESDelegate.java is derived from CFxARESInstanceDelegate, is the core piece between the host application and the kernel SDK and must initialized with the singleton CFxARESInstance.instance() from the main class. The SDK kernel starts to render the drawing into the CFxARESDocumentView object that will be accessed by getDocumentView() when a document is loaded and activated successfully.
Note: The host application application’s main class may be directly used as CFxARESInstanceDelegate but it is easier to split both parts of the application.
File: content_main.xml
Code Block | ||
---|---|---|
| ||
<com.graebert.aresinstance.CFxARESDocumentView android:id="@+id/id_aresview" android:layout_width="0dp" android:layout_height="0dp" android:visibility="gone" app:layout_constraintBottom_toTopOf="@id/id_bottompanel" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/id_background" /> |
...
The DWG Viewer reads all drawings from the assets/resources of the APK. This may result in a slower opening and rendering time. It is recommended to load drawings from a local or external folder of the device. The drawing is loaded with the OPEN command using the runCommand() method of the singleton CFxARESInstance.instance() and the CFxARESDocumentView can become visible. Once the drawing is loaded the CFxARESDelegate triggers documentCreated() followed by documentActivated(). This is the time when additional user interfaces can show up or drawing content can be accessed. In general, the CFxARESDelegate informs the host application about all important drawing events.
Note: The framework supports opening DWG, DXF and DWT files.
...