+ if (source instanceof AlignmentViewPanel)
+ {
+ AlignmentViewPanel panel = (AlignmentViewPanel) source;
+ SequenceI[][] sequence = new SequenceI[modelSet.length][];
+ for (int m = 0; m < modelSet.length; m++)
+ {
+ StructureMapping[] sm = ssm.getMapping(modelSet[m]);
+ if (sm != null && sm.length > 0)
+ {
+ sequence[m] = new SequenceI[sm.length];
+ for (int i = 0; i < sm.length; i++)
+ {
+ sequence[m][i] = sm[i].getSequence();
+ }
+ }
+ else
+ {
+ sequence[m] = new SequenceI[0];
+ }
+ // if (jvlite.debug)
+ // {
+ // System.err.println("Mapped '" + modelSet[m] + "' to "
+ // + sequence[m].length + " sequences.");
+ // }
+ }
+
+ SequenceRenderer sr = panel.getSequenceRenderer();
+ AlignViewportI vp = panel.getAlignViewport();
+ jalview.renderer.seqfeatures.FeatureRenderer fr = vp
+ .isShowSequenceFeatures() ? jvlite.getNewFeatureRenderer(vp)
+ : null;
+ if (fr != null)
+ {
+ fr.transferSettings(panel.getFeatureRenderer());
+ }
+
+ // Form a colour command from the given alignment panel for each distinct
+ // structure
+ ArrayList<String[]> ccomands = new ArrayList<>();
+ ArrayList<String> pdbfn = new ArrayList<>();
+ StructureMappingcommandSet[] colcommands = JmolCommands
+ .getColourBySequenceCommand(ssm, modelSet, sequence, sr,
+ (AlignmentViewPanel) source);
+ if (colcommands == null)
+ {
+ return;
+ }
+ int sz = 0;
+ for (jalview.structure.StructureMappingcommandSet ccset : colcommands)
+ {
+ sz += ccset.commands.length;
+ ccomands.add(ccset.commands);
+ pdbfn.add(ccset.mapping);
+ }
+
+ String ccomandset[] = new String[sz];
+ sz = 0;
+ for (String[] ccset : ccomands)
+ {
+ System.arraycopy(ccset, 0, ccomandset, sz, ccset.length);
+ sz += ccset.length;
+ }
+ String mclass = "colourstruct";
+ String mhandle = vp.getViewId();
+ if (isJsMessageSetChanged(mclass, mhandle, ccomandset, jvlite))
+ {
+ setJsMessageSet(mclass, mhandle, ccomandset, jvlite);
+ // and notify javascript handler
+ String st[] = new String[] { mclass, mhandle,
+ "" + ccomandset.length, jvlite.arrayToSeparatorList(
+ pdbfn.toArray(new String[pdbfn.size()])) };
+ executeJavascriptFunction(true, st);
+ }
+ /*
+ * new Thread(new Runnable() { public void run() { // and send to
+ * javascript handler String st[] = new String[0]; int i = 0; for (String
+ * colcommand : colcommands) { // do sync execution for each chunk try {
+ * executeJavascriptFunction( false, _listenerfn, st = new String[] {
+ * "colourstruct", "" + ((jalview.appletgui.AlignmentPanel) source).av
+ * .getViewId(), handle, "" }); } catch (Exception ex) {
+ * System.err.println("Couldn't execute callback with " + _listenerfn +
+ * " using args { " + st[0] + ", " + st[1] + ", " + st[2] + "," + st[3] +
+ * "\n"); ex.printStackTrace();
+ *
+ * } } } }).start();
+ */
+ }
+
+ jvlite.updateColoursFromMouseOver(source, this);