Example #1
0
 private void initSelectionModel() {
   this.selectionModel =
       new NucleotideSelectionModel(
           rnaSequence3D
               .getNucleotides()
               .toArray(new Nucleotide[rnaSequence3D.getNucleotides().size()]));
 }
Example #2
0
  /** Method that loads all necessary information and initiates the views, the keyhandlers etc. */
  public void loadProgramDataFromPdb() {
    // Extract nucleotide information
    rnaSequence3D = new RNASequence(getModel().getPdbfile());

    // Extract base-sequence and compute watson-crick bonds
    getModel().setSequence(rnaSequence3D.extractString());
    getModel().setBonds(rnaSequence3D.computeWCBonds());

    // Init selection Model
    initSelectionModel();

    // Init the Views
    initPrimaryView();
    initSecondaryView();
    initTertiaryView();

    // init focus selection listener
    initSelectionListener();
    selectionFocusBinding();

    // init keyhandler
    if (keyPressedEventHandler != null)
      scene.removeEventFilter(KeyEvent.KEY_PRESSED, keyPressedEventHandler);
    initKeyEventHandler();
    scene.addEventFilter(KeyEvent.KEY_PRESSED, keyPressedEventHandler);
  }
Example #3
0
 private void loadOneModel(int model) {
   switch (model) {
     case 0:
       rnaSequence3D.addModel(new StickModel());
       break;
     case 1:
       rnaSequence3D.addModel(new MeshModel());
       break;
     case 2:
       rnaSequence3D.addModel(new BallModel());
       break;
   }
   tertiaryRoom.getObject().getChildren().addAll(rnaSequence3D.getModels().get(0));
 }
Example #4
0
 private void activateRightSideButtons() {
   colorPyrpur.setOnAction(
       (me) -> {
         ((MeshModel) rnaSequence3D.getModels().get(1)).colorPyrPur();
       });
   colorAugc.setOnAction(
       (me) -> {
         ((MeshModel) rnaSequence3D.getModels().get(1)).colorBases();
       });
   centerObject.setOnAction(
       (me) -> {
         tertiaryRoom.setCameraCenter(rnaSequence3D.computeCenter());
       });
 }
Example #5
0
 private void initSelectionListener() {
   selectionFocusListener =
       c -> {
         if (selectionModel.getSelectedItems().isEmpty())
           tertiaryRoom.setCameraCenter(rnaSequence3D.computeCenter());
         if (selectionModel.getSelectedIndices().size() > 0) selectFocus();
       };
 }
Example #6
0
  private void clearModels() {
    structureStick.selectedProperty().unbind();
    structureBall.selectedProperty().unbind();
    structureMesh.selectedProperty().unbind();

    structureBall.setOnAction(event -> {});

    rnaSequence3D.getModels().clear();
  }
Example #7
0
  /** initialize secondary structure view items */
  private void initSecondaryView() {
    // clear the secondary structure pane on initialization
    pane2D.getChildren().clear();

    if (view2DController.getGraph2d() != null) {
      pane2D.widthProperty().removeListener(view2DController.getWidthChangeListener());
      pane2D.heightProperty().removeListener(view2DController.getHeightChangeListener());
    }

    view2DController.initGraph2d(
        rnaSequence3D.extractString(),
        rnaSequence3D.getNucleotides().size(),
        rnaSequence3D.computeWCBonds(),
        (int) pane2D.getWidth(),
        (int) pane2D.getHeight());

    listenOnPane2dResize();
    view2DController.setScaleBinding(pane2D.widthProperty(), pane2D.heightProperty());

    view2DController.getGraph2d().setSelectionModel(selectionModel);
    pane2D.getChildren().add(view2DController.getGraph2d());
  }
Example #8
0
  /** initialize tertiary structure view */
  private void initTertiaryView() {
    Group models3D = new Group();
    rnaSequence3D = new RNASequence(model.getPdbfile());

    if (tertiaryRoom == null) {
      tertiaryRoom = new Room(models3D, 50, 50);
      tertiaryRoom.rotateCamera(tertiaryRoom);
      tertiaryRoom.scaleCamera(scene);
      tertiaryRoom.alignToParent(pane3D);
      tertiaryRoom.setPickOnBounds(false);
      pane3D.getChildren().add(tertiaryRoom);
    } else {
      tertiaryRoom.setObject(rnaSequence3D);
    }

    if (reloadItem.isSelected()) loadOneModel(0);
    if (!reloadItem.isSelected()) loadAllmodels();
    ((MeshModel) rnaSequence3D.getModels().get(1)).colorPyrPur();

    rnaSequence3D.setSelectionModel(selectionModel);
    tertiaryRoom.setCameraCenter(rnaSequence3D.computeCenter());

    activateRightSideButtons();
  }
Example #9
0
  private void loadAllmodels() {
    rnaSequence3D.addModel(new StickModel());
    rnaSequence3D.addModel(new MeshModel());
    rnaSequence3D.addModel(new BallModel());

    structureStick.selectedProperty().unbind();
    structureMesh.selectedProperty().unbind();
    structureBall.selectedProperty().unbind();

    rnaSequence3D.getModels().get(0).visibleProperty().bind(structureStick.selectedProperty());
    rnaSequence3D.getModels().get(1).visibleProperty().bind(structureMesh.selectedProperty());
    rnaSequence3D.getModels().get(2).visibleProperty().bind(structureBall.selectedProperty());

    tertiaryRoom.getObject().getChildren().addAll(rnaSequence3D.getModels().get(0));
    tertiaryRoom.getObject().getChildren().addAll(rnaSequence3D.getModels().get(1));
    tertiaryRoom.getObject().getChildren().addAll(rnaSequence3D.getModels().get(2));
  }