Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
private void SwitchViewMode( boolean panMode ){
...
CFxARESInstance.instance().runCommand("'2dmode     $M=$(if,$(and,$(getvar,2dmode),1),$(-,$(getvar,2dmode),1),$(+,$(getva    r,2dmode),1))");
}


NoteHint:  The core also provides You can achieve similar results with commands like ZOOM or PAN to achieve similar results.

DWG Viewer - Java Native Interface

Status
titleJAVA
Status
colourYellow
titleC++

Executing core commands is a good approach to quickly achieve results but in some cases it is necessary to access directly the drawing content or system relevant parameters.  The JNI, the Java Native Interface , allows to exchange data between Java and C++ or to directly manipulate drawing content. The synergy works with a combination of native Java methods and a matching C++ implementation that follows the JNI specifications. The C++ code is managed with CMake and compiled with the NDK. The created shared library (*.so) must be loaded using System.loadLibrary(). The JNI supports executing code in both directions.

...

Code Block
languagecpp
JNIEXPORT void JNICALL Java_com_graebert_aressimplified_JNI_SetBackgroundColor( JNIEnv * env, jclass clazz, jint color )
{
    ODCOLORREF background = 0;
    switch ( color )
    {
        case 1:
            background = 0;
            break;
        case 2:
            background = ODRGB( 255, 255, 255 );
            break;
        case 3:
            background = ODRGB( 255, 0, 255 );
            break;
    }

    OdEditorImplPtr pEditor = odedEditor();
    pEditor->fire_modelessOperationWillStart( L"BACKGROUND_COLOR" );
    ACTIVE_DOCUMENT()->GetFxDisplayDevice()->SetBackground( background );
    pEditor->fire_modelessOperationEnded( L"BACKGROUND_COLOR" );
}

DWG Vewer Viewer - Switch between model and sheets

Status
titleJAVA
Status
colourYellow
titleC++

...