Esempio n. 1
0
        public cFeedBackMessage Run(c3DNewWorld _3DWorld)
        {
            if (this.Input == null)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "No input data table defined.";
                return FeedBackMessage;
            }

            ListObjects = new cListGeometric3DObject("Axis MetaObject");
            cExtendedList ListLenghts = new cExtendedList();
            double MinLenght;
            cPoint3D Pt1 = null;
            cPoint3D Pt2 = null;
            cPoint3D Pt3 = null;

            if (this.Input.Count == 1)
            {
                cPoint3D Pt0 = new cPoint3D(this.Input[0][0], 0, 0);
                Pt1 = new cPoint3D(this.Input[0][1], 0, 0);
                ListLenghts.Add(Pt0.DistTo(Pt1));

                MinLenght = ListLenghts.Min();

                if (MinLenght == 0) MinLenght = 1;

                c3DLine XAxis = new c3DLine(Pt0, Pt1);
                XAxis.Tag = this.Input[0].Tag;
                XAxis.SetName("Axis - " + this.Input[0].Name);
                ListObjects.AddObject(XAxis);

            }
            else if (this.Input.Count == 2)
            {
                cPoint3D Pt0 = new cPoint3D(this.Input[0][0], this.Input[1][0], 0);
                Pt1 = new cPoint3D(this.Input[0][1], this.Input[1][0], 0);
                ListLenghts.Add(Pt0.DistTo(Pt1));
                Pt2 = new cPoint3D(this.Input[0][0], this.Input[1][1], 0);
                ListLenghts.Add(Pt0.DistTo(Pt2));

                MinLenght = ListLenghts.Min();

                if (MinLenght == 0) MinLenght = 1;

                c3DLine XAxis = new c3DLine(Pt0, Pt1);
                XAxis.Tag = this.Input[0].Tag;
                XAxis.SetName("Axis - " + this.Input[0].Name);
                ListObjects.AddObject(XAxis);

                c3DLine YAxis = new c3DLine(Pt0, Pt2);
                YAxis.Tag = this.Input[1].Tag;
                YAxis.SetName("Axis - " + this.Input[1].Name);
                ListObjects.AddObject(YAxis);

            }
            else
            {
                cPoint3D Pt0 = new cPoint3D(this.Input[0][0], this.Input[1][0], this.Input[2][0]);
                Pt1 = new cPoint3D(this.Input[0][1], this.Input[1][0], this.Input[2][0]);
                ListLenghts.Add(Pt0.DistTo(Pt1));

                Pt2 = new cPoint3D(this.Input[0][0], this.Input[1][1], this.Input[2][0]);
                ListLenghts.Add(Pt0.DistTo(Pt2));

                Pt3 = new cPoint3D(this.Input[0][0], this.Input[1][0], this.Input[2][1]);
                ListLenghts.Add(Pt0.DistTo(Pt3));

                MinLenght = ListLenghts.Min();

                if (MinLenght == 0) MinLenght = 1;

                c3DLine XAxis = new c3DLine(Pt0, Pt1,Color.Black);
                XAxis.Tag = this.Input[0].Tag;
                XAxis.SetName("Axis - " + this.Input[0].Name);

                ListObjects.AddObject(XAxis);

                c3DLine YAxis = new c3DLine(Pt0, Pt2,Color.Black);
                YAxis.Tag = this.Input[1].Tag;
                YAxis.SetName("Axis - " + this.Input[1].Name);
                ListObjects.AddObject(YAxis);

                c3DLine ZAxis = new c3DLine(Pt0, Pt3,Color.Black);
                ZAxis.Tag = this.Input[2].Tag;
                ZAxis.SetName("Axis - " + this.Input[2].Name);
                ListObjects.AddObject(ZAxis);

            }

            #region draw text
            double TextScale = MinLenght;

            if (MinLenght == 1) TextScale = 1;

            cPoint3D PosText = Pt1;

            // display the axis name
            c3DText TmpText = new c3DText(_3DWorld, this.Input[0].Name, PosText, Color.Black, 0.02 * TextScale);
            TmpText.Tag = this.Input[0].Tag;
            ListObjects.AddObject(TmpText);

            // MinX
            PosText = new cPoint3D(0, 0, 0);

            PosText.X = this.Input[0][0];
            if (this.Input.Count > 1) PosText.Y = this.Input[1][0];
            if (this.Input.Count > 2) PosText.Z = this.Input[2][0] - TextScale * 0.03;

            ListObjects.AddObject(new c3DText(_3DWorld, this.Input[0][0].ToString("N3"), PosText, Color.DimGray, 0.01 * TextScale));

            // MaxX
            PosText.X = this.Input[0][1];
            if (this.Input.Count > 1) PosText.Y = this.Input[1][0];
            if (this.Input.Count > 2) PosText.Z = this.Input[2][0] - TextScale * 0.03;

            if (this.Input.Count > 1) ListObjects.AddObject(new c3DText(_3DWorld, this.Input[0][1].ToString("N3"), PosText, Color.DimGray, 0.01 * TextScale));

            if (Pt2 != null)
            {
                PosText = Pt2;
                TmpText = new c3DText(_3DWorld, this.Input[1].Name, PosText, Color.Black, 0.02 * TextScale);
                TmpText.Tag = this.Input[1].Tag;
                ListObjects.AddObject(TmpText);

                // MinY
                PosText.X = this.Input[0][0] - TextScale * 0.03;// + TextScale*0.02;
                if (this.Input.Count > 1) PosText.Y = this.Input[1][0];// -TextScale * 0.03;
                if (this.Input.Count > 2) PosText.Z = this.Input[2][0] - TextScale * 0.03;
                ListObjects.AddObject(new c3DText(_3DWorld, this.Input[1][0].ToString("N3"), PosText, Color.DimGray, 0.01 * TextScale));

                PosText.X = this.Input[0][0] - TextScale * 0.03;// + TextScale*0.02;
                if (this.Input.Count > 1) PosText.Y = this.Input[1][1];// -TextScale * 0.03;
                if (this.Input.Count > 2) PosText.Z = this.Input[2][0] - TextScale * 0.03;
                ListObjects.AddObject(new c3DText(_3DWorld, this.Input[1][1].ToString("N3"), PosText, Color.DimGray, 0.01 * TextScale));
            }

            if (Pt3 != null)
            {

                PosText = Pt3;
                TmpText = new c3DText(_3DWorld, this.Input[2].Name, /*new cPoint3D(-0.04, -0.04, 0.45)*/ PosText, Color.Black, 0.02 * TextScale);
                TmpText.Tag = this.Input[2].Tag;
                ListObjects.AddObject(TmpText);

                PosText.X = this.Input[0][0] - TextScale * 0.03;// + TextScale*0.02;
                PosText.Y = this.Input[1][0];// -TextScale * 0.03;
                PosText.Z = this.Input[2][0];
                ListObjects.AddObject(new c3DText(_3DWorld, this.Input[2][0].ToString("N3"), PosText, Color.DimGray, 0.01 * TextScale));

                PosText.X = this.Input[0][0] - TextScale * 0.03;// + TextScale*0.02;
                PosText.Y = this.Input[1][0];// -TextScale * 0.03;
                PosText.Z = this.Input[2][1];

                ListObjects.AddObject(new c3DText(_3DWorld, this.Input[2][1].ToString("N3"), PosText, Color.DimGray, 0.01 * TextScale));
            }
            #endregion

            return base.FeedBackMessage;
        }
Esempio n. 2
0
        public cGeometric3DObject AttachText(string Text, double Scale, Color Colour)
        {
            c3DText AssociatedText = new c3DText(Text, this.GetPosition(), Colour, Scale);

            AssociatedText.AssociatedObject = this;
            return AssociatedText;
        }
Esempio n. 3
0
        public void DisplayXYZ()
        {
            if (CompleteScreening == null) return;

            int DescX = this.comboBoxDescriptorX.SelectedIndex;
            int DescY = this.comboBoxDescriptorY.SelectedIndex;
            int DescZ = this.comboBoxDescriptorZ.SelectedIndex;

            if (DescX < 0) DescX = 0;
            if (DescY < 0) DescY = 0;
            if (DescZ < 0) DescZ = 0;

            int[] Pos = new int[2];
            Pos[0] = 0;
            Pos[1] = 0;

            if (CurrentWorld == null)
            {
                CurrentWorld = new c3DWorld(new cPoint3D(1000, 1000, 1000), new cPoint3D(ListScales[DescX], ListScales[DescY], ListScales[DescZ]), this.renderWindowControl1, Pos, CompleteScreening);
                light = vtkLight.New();
                CurrentWorld.SetBackgroundColor(Color.Black);
               // CurrentWorld.ren1.AddLight(light);
                //CurrentWorld.ren1.RemoveAllLights();
            }

            CurrentWorld.ren1.RemoveAllViewProps();

            //  if (widget != null) widget.SetEnabled(0);

            Series CurrentSeries = new Series("ScatterPoints");

            double MinX = double.MaxValue;
            double MinY = double.MaxValue;
            double MinZ = double.MaxValue;
            double MaxZ = double.MinValue;
            double MaxX = double.MinValue;
            double MaxY = double.MinValue;

            double TempX, TempY, TempZ;
            int Idx = 0;

            cListPlates ListPlate = new cListPlates();

            cMetaBiologicalObjectList ListMeta = new cMetaBiologicalObjectList("Test");
            cBiologicalSpot CurrentSpot1 = new cBiologicalSpot(Color.White, new cPoint3D(0, 0, 0), 1, 4);
            cMetaBiologicalObject Plate3D = new cMetaBiologicalObject("Data", ListMeta, CurrentSpot1);

            if (!IsFullScreen)
                ListPlate.Add(CompleteScreening.GetCurrentDisplayPlate());
            else
                ListPlate = CompleteScreening.ListPlatesActive;

            vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();
            colors.SetName("colors");
            colors.SetNumberOfComponents(3);
            vtkPoints Allpoints = vtkPoints.New();

            cExtendedList ListPtX = new cExtendedList();
            cExtendedList ListPtY = new cExtendedList();
            cExtendedList ListPtZ = new cExtendedList();

            List<bool> ListCheckBoxes = ClassSelectionPanel.GetListSelectedClass();

            for (int i = 0; i < ListPlate.Count; i++)
            {
                cPlate CurrentPlate = ListPlate[i];
                for (int IdxValue = 0; IdxValue < CompleteScreening.Columns; IdxValue++)
                    for (int IdxValue0 = 0; IdxValue0 < CompleteScreening.Rows; IdxValue0++)
                    {
                        cWell TmpWell = CurrentPlate.GetWell(IdxValue, IdxValue0, true);
                        if ((TmpWell != null) && (ListCheckBoxes[TmpWell.GetCurrentClassIdx()]))
                        {

                            TempX = TmpWell.ListSignatures[DescX].GetValue();
                            if (TempX < MinX) MinX = TempX;
                            if (TempX > MaxX) MaxX = TempX;

                            TempY = TmpWell.ListSignatures[DescY].GetValue();
                            if (TempY < MinY) MinY = TempY;
                            if (TempY > MaxY) MaxY = TempY;

                            TempZ = TmpWell.ListSignatures[DescZ].GetValue();
                            if (TempZ < MinZ) MinZ = TempZ;
                            if (TempZ > MaxZ) MaxZ = TempZ;

                            //   cBiologicalSpot CurrentSpot = new cBiologicalSpot(TmpWell.GetColor(), new cPoint3D(TempX, TempY, TempZ), 1, 4);

                            List<char> Col = new List<char>();

                            Col.Add((char)(TmpWell.GetClassColor().R));
                            Col.Add((char)(TmpWell.GetClassColor().G));
                            Col.Add((char)(TmpWell.GetClassColor().B));

                            // IntPtr unmanagedPointer = Marshal.UnsafeAddrOfPinnedArrayElement(Col.ToArray(), 0);

                            //colors.InsertNextTupleValue(unmanagedPointer);
                            colors.InsertNextTuple3(Col[0], Col[1], Col[2]);

                            ListPtX.Add(TempX);
                            ListPtY.Add(TempY);
                            ListPtZ.Add(TempZ);

                            //     CurrentSpot.Name = TmpWell.AssociatedPlate.Name + " - " + TmpWell.GetPosX() + "x" + TmpWell.GetPosY() + " :" + TmpWell.Name;
                            //    CurrentSpot.ObjectType = TmpWell.AssociatedPlate.Name + " - " + TmpWell.GetPosX() + "x" + TmpWell.GetPosY() + " :" + TmpWell.Name;
                            //    Plate3D.AddObject(CurrentSpot);
                            // CurrentWorld.AddBiological3DObject(CurrentSpot);
                            //CurrentSeries.Points.Add(TempX, TempY);

                            //                                if (IsFullScreen)
                            //                                    CurrentSeries.Points[Idx].ToolTip = TmpWell.AssociatedPlate.Name + "\n" + TmpWell.GetPosX() + "x" + TmpWell.GetPosY() + " :" + TmpWell.Name;
                            //                                else
                            //                                    CurrentSeries.Points[Idx].ToolTip = TmpWell.GetPosX() + "x" + TmpWell.GetPosY() + " :" + TmpWell.Name;

                            Idx++;
                        }
                    }
            }

            double MinValueX = ListPtX.Min();
            double MaxValueX = ListPtX.Max();
            cExtendedList NormX = ListPtX.Normalize(eNormalizationType.MIN_MAX);
            if (NormX == null) return;

            double MinValueY = ListPtY.Min();
            double MaxValueY = ListPtY.Max();
            cExtendedList NormY = ListPtY.Normalize(eNormalizationType.MIN_MAX);
            if (NormY == null) return;

            double MinValueZ = ListPtZ.Min();
            double MaxValueZ = ListPtZ.Max();
            cExtendedList NormZ = ListPtZ.Normalize(eNormalizationType.MIN_MAX);
            if (NormZ == null) return;

            for (int IdxPt = 0; IdxPt < ListPtX.Count; IdxPt++)
                Allpoints.InsertNextPoint(NormX[IdxPt], NormY[IdxPt], NormZ[IdxPt]);

            vtkPolyData polydata = vtkPolyData.New();
            polydata.SetPoints(Allpoints);
            polydata.GetPointData().SetScalars(colors);
               // vtkSphereSource SphereSource = vtkSphereSource.New();
            SphereSource.SetRadius(RadiusSphere);
            //SphereSource
            vtkGlyph3D glyph3D = vtkGlyph3D.New();
            glyph3D.SetColorModeToColorByScalar();
            glyph3D.SetSourceConnection(SphereSource.GetOutputPort());

            glyph3D.SetInput(polydata);
            glyph3D.ScalingOff();
            glyph3D.Update();

            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
            mapper.SetInputConnection(glyph3D.GetOutputPort());
            actorSpheres = vtkActor.New();
            actorSpheres.SetMapper(mapper);
            actorSpheres.GetProperty().SetOpacity(this.SphereOpacity);
            CurrentWorld.ren1.AddActor(actorSpheres);

            if (this.IsLightAutomated)
            {
                CurrentWorld.ren1.RemoveAllLights();
                CurrentWorld.ren1.AutomaticLightCreationOn();
               // this.light.SetIntensity(0);
            }
            else
            {
                CurrentWorld.ren1.RemoveAllLights();
                CurrentWorld.ren1.AddLight(light);
                this.light.SetIntensity(this.LightIntensity);
                CurrentWorld.ren1.AutomaticLightCreationOff();
                actorSpheres.GetProperty().SetInterpolationToPhong();
                actorSpheres.GetProperty().SetAmbient(this.LightAmbient);
                actorSpheres.GetProperty().SetDiffuse(this.LightDiffuse);
                actorSpheres.GetProperty().SetSpecular(this.LightSpecular);

                light.SetFocalPoint(0.5, 0.5, 1);
                light.SetPosition(0.5, 0.5, -1);

                light.SetDiffuseColor(1, 1, 1);

                if (this.IsDisplayLightSource)
                {
                    light.SetPositional(1);
                    vtkLightActor lightActor = vtkLightActor.New();
                    lightActor.SetLight(light);
                    CurrentWorld.ren1.AddViewProp(lightActor);
                }

            }

            #region Connect For DRC
            if ((CompleteScreening.GetCurrentDisplayPlate().ListDRCRegions != null) && (cGlobalInfo.OptionsWindow.checkBoxConnectDRCPts.Checked))
            {
                foreach (cDRC_Region TmpRegion in CompleteScreening.GetCurrentDisplayPlate().ListDRCRegions)
                {
                    int cpt = 0;

                    cWell[][] ListWells = TmpRegion.GetListWells();

                    foreach (cWell[] item in ListWells)
                    {
                        for (int IdxWell = 0; IdxWell < item.Length - 1; IdxWell++)
                        {
                            //cWell TmpWell0 = CompleteScreening.GetCurrentDisplayPlate().GetWell(item[IdxWell], IdxValue0, true);

                            if ((item[IdxWell] != null) && (item[IdxWell + 1] != null) && (item[IdxWell].GetCurrentClassIdx() >= -1))
                            {
                                double StartX = (item[IdxWell].ListSignatures[DescX].GetValue() - MinValueX) / (MaxValueX - MinValueX);
                                double StartY = (item[IdxWell].ListSignatures[DescY].GetValue() - MinValueY) / (MaxValueY - MinValueY);
                                double StartZ = (item[IdxWell].ListSignatures[DescZ].GetValue() - MinValueZ) / (MaxValueZ - MinValueZ);
                                double EndX = (item[IdxWell + 1].ListSignatures[DescX].GetValue() - MinValueX) / (MaxValueX - MinValueX);
                                double EndY = (item[IdxWell + 1].ListSignatures[DescY].GetValue() - MinValueY) / (MaxValueY - MinValueY);
                                double EndZ = (item[IdxWell + 1].ListSignatures[DescZ].GetValue() - MinValueZ) / (MaxValueZ - MinValueZ);
                                cPoint3D StartPt = new cPoint3D(StartX, StartY, StartZ);
                                cPoint3D EndPt = new cPoint3D(EndX, EndY, EndZ);
                                c3DLine NewLine = new c3DLine(StartPt, EndPt);
                                CurrentWorld.AddGeometric3DObject(NewLine);
                            }

                        }
                    }
                    /*List<cDRC> ListDRC = new List<cDRC>();
                    for (int i = 0; i < CompleteScreening.ListDescriptors.Count; i++)
                    {
                        if (CompleteScreening.ListDescriptors[i].IsActive())
                        {
                            cDRC CurrentDRC = new cDRC(TmpRegion, CompleteScreening.ListDescriptors[i]);

                            ListDRC.Add(CurrentDRC);
                            cpt++;
                        }

                    }
                    */
                    //cDRCDisplay DRCDisplay = new cDRCDisplay(ListDRC, GlobalInfo);

                    //if (DRCDisplay.CurrentChart.Series.Count == 0) continue;

                    //DRCDisplay.CurrentChart.Location = new Point((DRCDisplay.CurrentChart.Width + 50) * 0, (DRCDisplay.CurrentChart.Height + 10 + DRCDisplay.CurrentRichTextBox.Height) * h++);
                    //DRCDisplay.CurrentRichTextBox.Location = new Point(DRCDisplay.CurrentChart.Location.X, DRCDisplay.CurrentChart.Location.Y + DRCDisplay.CurrentChart.Height + 5);

                    //WindowforDRCsDisplay.LChart.Add(DRCDisplay.CurrentChart);
                    //WindowforDRCsDisplay.LRichTextBox.Add(DRCDisplay.CurrentRichTextBox);
                }
            }
            #endregion

            #region Build axis
            // vtkAxesActor axis = vtkAxesActor.New();
            vtkAxisActor axisX = vtkAxisActor.New();
            axisX.SetPoint1(0, 0, 0);
            axisX.SetPoint2(1, 0, 0);
            axisX.SetTickLocationToBoth();
            axisX.SetDeltaMajor(0.1);
            axisX.SetMajorTickSize(0);
            axisX.MinorTicksVisibleOff();
            //axisX.Maj
            CurrentWorld.ren1.AddActor(axisX);

            vtkAxisActor axisY = vtkAxisActor.New();
            axisY.SetPoint1(0, 0, 0);
            axisY.SetPoint2(0, 1, 0);
            axisY.SetTickLocationToBoth();
            axisY.SetDeltaMajor(0.1);
            axisY.SetMajorTickSize(0.05);
            axisY.MinorTicksVisibleOff();
            CurrentWorld.ren1.AddActor(axisY);

            vtkAxisActor axisZ = vtkAxisActor.New();
            axisZ.SetPoint1(0, 0, 0);
            axisZ.SetPoint2(0, 0, 1);
            axisZ.SetTickLocationToBoth();
            axisZ.SetDeltaMajor(0.1);
            axisZ.SetMajorTickSize(0.05);
            axisZ.MinorTicksVisibleOff();
            CurrentWorld.ren1.AddActor(axisZ);

            if (widget == null)
            {
                widget = vtkOrientationMarkerWidget.New();

                axes = vtkAxesActor.New();
                widget.SetOutlineColor(0.9300, 0.5700, 0.1300);

                widget.SetInteractor(CurrentWorld.iren);
                widget.SetViewport(0.0, 0.0, 0.4, 0.4);
                widget.SetEnabled(0);
                // widget.InteractiveOn();

                if (this.comboBoxDescriptorX.SelectedItem == null)
                    axes.SetXAxisLabelText(this.comboBoxDescriptorX.Items[0].ToString());
                else
                    axes.SetXAxisLabelText(this.comboBoxDescriptorX.SelectedItem.ToString());

                if (this.comboBoxDescriptorY.SelectedItem == null)
                    axes.SetYAxisLabelText(this.comboBoxDescriptorY.Items[0].ToString());
                else
                    axes.SetYAxisLabelText(this.comboBoxDescriptorY.SelectedItem.ToString());

                if (this.comboBoxDescriptorZ.SelectedItem == null)
                    axes.SetZAxisLabelText(this.comboBoxDescriptorZ.Items[0].ToString());
                else
                    axes.SetZAxisLabelText(this.comboBoxDescriptorZ.SelectedItem.ToString());

                widget.SetOrientationMarker(axes);
            }
            else
            {
                if (this.comboBoxDescriptorX.SelectedItem != null)
                    axes.SetXAxisLabelText(this.comboBoxDescriptorX.SelectedItem.ToString());

                if (this.comboBoxDescriptorY.SelectedItem != null)
                    axes.SetYAxisLabelText(this.comboBoxDescriptorY.SelectedItem.ToString());

                if (this.comboBoxDescriptorZ.SelectedItem != null)
                    axes.SetZAxisLabelText(this.comboBoxDescriptorZ.SelectedItem.ToString());

                widget.SetOrientationMarker(axes);
            }

            if ((this.checkBoxForDisplayAxesInformation.Checked) && (ListPtX.Count > 0))
            {
                double CurrentFontSize = this.FontSize / 400.0;// 0.02;

                c3DText MaxAxeX = new c3DText(CurrentWorld, MaxValueX.ToString("N2"), new cPoint3D(1, 0, 0), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MaxAxeX);

                c3DText MaxAxeY = new c3DText(CurrentWorld, MaxValueY.ToString("N2"), new cPoint3D(0, 1, 0), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MaxAxeY);

                c3DText MaxAxeZ = new c3DText(CurrentWorld, MaxValueZ.ToString("N2"), new cPoint3D(0, 0, 1), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MaxAxeZ);

                c3DText MinAxeX = new c3DText(CurrentWorld, MinValueX.ToString("N2"), new cPoint3D(0, -0.1, -0.1), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MinAxeX);

                c3DText MinAxeY = new c3DText(CurrentWorld, MinValueY.ToString("N2"), new cPoint3D(-0.1, -0.1, 0), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MinAxeY);

                c3DText MinAxeZ = new c3DText(CurrentWorld, MinValueZ.ToString("N2"), new cPoint3D(-0.1, 0, -0.1), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MinAxeZ);
            }
            #endregion

            //vtkCameraWidget Wid = vtkCameraWidget.New();
            //Wid.SetInteractor(CurrentWorld.iren);
            //Wid.SetEnabled(1);
            //  Wid.InteractiveOn();

            //vtkDistanceWidget distanceWidget = vtkDistanceWidget.New();
            //distanceWidget.SetInteractor(CurrentWorld.iren);
            //distanceWidget.SetEnabled(1);
            //distanceWidget.CreateDefaultRepresentation();
            //((vtkDistanceRepresentation)distanceWidget.GetRepresentation()).SetLabelFormat("%-#6.3g mm");
            /*static_cast<vtkDistanceRepresentation*>(distanceWidget->GetRepresentation())
              ->SetLabelFormat("%-#6.3g mm");

                      */
            //  Plate3D.GenerateAndDisplayBoundingBox(1, Color.White, false, CurrentWorld);
            //c3DText CaptionX = new c3DText(CurrentWorld, CompleteScreening.ListDescriptors[DescX].GetName(), new cPoint3D(MaxX, MinY, MinZ), Color.DarkRed, this.FontSize);
            //c3DLine LineX = new c3DLine(new cPoint3D(MinX, MinY, MinZ), new cPoint3D(MaxX, MinY, MinZ), Color.DarkRed);
            //CurrentWorld.AddGeometric3DObject(LineX);

            //c3DText CaptionY = new c3DText(CurrentWorld, CompleteScreening.ListDescriptors[DescY].GetName(), new cPoint3D(MinX, MaxY, MinZ), Color.DarkGreen, this.FontSize);
            //c3DLine LineY = new c3DLine(new cPoint3D(MinX, MinY, MinZ), new cPoint3D(MinX, MaxY, MinZ), Color.DarkGreen);
            //CurrentWorld.AddGeometric3DObject(LineY);

            //c3DText CaptionZ = new c3DText(CurrentWorld, CompleteScreening.ListDescriptors[DescZ].GetName(), new cPoint3D(MinX, MinY, MaxZ), Color.DarkBlue, this.FontSize);
            //c3DLine LineZ = new c3DLine(new cPoint3D(MinX, MinY, MinZ), new cPoint3D(MinX, MinY, MaxZ), Color.DarkBlue);
            //CurrentWorld.AddGeometric3DObject(LineZ);

            #region Update ComboBoxes
            if (comboBoxDescriptorX.Text == "")
                ToolTipForX.SetToolTip(comboBoxDescriptorX, comboBoxDescriptorX.Items[0].ToString());
            else
                ToolTipForX.SetToolTip(comboBoxDescriptorX, comboBoxDescriptorX.Text);

            if (comboBoxDescriptorY.Text == "")
                ToolTipForY.SetToolTip(comboBoxDescriptorY, comboBoxDescriptorY.Items[0].ToString());
            else
                ToolTipForY.SetToolTip(comboBoxDescriptorY, comboBoxDescriptorY.Text);

            if (comboBoxDescriptorZ.Text == "")
                ToolTipForZ.SetToolTip(comboBoxDescriptorZ, comboBoxDescriptorZ.Items[0].ToString());
            else
                ToolTipForZ.SetToolTip(comboBoxDescriptorZ, comboBoxDescriptorZ.Text);
            #endregion

            CurrentWorld.SimpleRender();// Render();
        }
Esempio n. 4
0
        public void Display3Dplate(int IdxDescriptor, cPoint3D MinimumPosition)
        {
            ParentScreening._3DWorldForPlateDisplay.ListMetaObjectList = new List<cMetaBiologicalObjectList>();
            cMetaBiologicalObjectList ListMetacells = new cMetaBiologicalObjectList("List Meta Objects");
            ParentScreening._3DWorldForPlateDisplay.ListMetaObjectList.Add(ListMetacells);

            c3DWell NewPlate3D = new c3DWell(new cPoint3D(0, 0, 0), new cPoint3D(ParentScreening.Columns, ParentScreening.Rows, 1), Color.Black, null);
            NewPlate3D.SetOpacity(0.0);

            cMetaBiologicalObject Plate3D = new cMetaBiologicalObject(this.Name, ListMetacells, NewPlate3D);

            #region  display the well list

            foreach (cWell TmpWell in this.ListWell)
            {
                if ((TmpWell == null) || (TmpWell.GetCurrentClassIdx() == -1)) continue;

                double PosZ = 8 - ((TmpWell.ListSignatures[IdxDescriptor].GetValue() - this.ListMinMax[IdxDescriptor][0]) * 8) / (this.ListMinMax[IdxDescriptor][1] - this.ListMinMax[IdxDescriptor][0]);

                double WellSize = (double)cGlobalInfo.OptionsWindow.numericUpDownWellSize.Value;
                double WellBorder = (1 - WellSize) / 2.0;

                cPoint3D CurrentPos = new cPoint3D(TmpWell.GetPosX() - WellBorder + MinimumPosition.X, TmpWell.GetPosY() + WellBorder + MinimumPosition.Y - WellSize / 2, PosZ + MinimumPosition.Z - WellBorder);
                Color WellColor = Color.Black;

                if (cGlobalInfo.IsDisplayClassOnly)
                    WellColor = TmpWell.GetClassColor();
                else
                {
                    int ConvertedValue;
                    byte[][] LUT = cGlobalInfo.CurrentPlateLUT;

                    if (this.ListMinMax[IdxDescriptor][0] == this.ListMinMax[IdxDescriptor][1])
                        ConvertedValue = 0;
                    else
                        ConvertedValue = (int)(((TmpWell.ListSignatures[IdxDescriptor].GetValue() - this.ListMinMax[IdxDescriptor][0]) * (LUT[0].Length - 1)) / (this.ListMinMax[IdxDescriptor][1] - this.ListMinMax[IdxDescriptor][0]));
                    if ((ConvertedValue >= 0) && (ConvertedValue < LUT[0].Length))
                        WellColor = Color.FromArgb(LUT[0][ConvertedValue], LUT[1][ConvertedValue], LUT[2][ConvertedValue]);
                }

                c3DWell New3DWell = new c3DWell(CurrentPos, new cPoint3D(CurrentPos.X + WellSize, CurrentPos.Y + WellSize, CurrentPos.Z + WellSize / 2.0), WellColor, TmpWell);
                New3DWell.SetType("[" + TmpWell.GetPosX() + " x " + TmpWell.GetPosY() + "]");

                cPropertyType WellPropertyType = null;
                foreach (object item in cGlobalInfo.WindowHCSAnalyzer.toolStripDropDownButtonDisplayMode.DropDownItems)
                {

                    if (item.GetType() == typeof(ToolStripMenuItem))
                    {
                        ToolStripMenuItem TmpMenuItem = ((ToolStripMenuItem)item);

                        if (TmpMenuItem.Checked && (TmpMenuItem.Tag != null) && (TmpMenuItem.Tag.GetType() == typeof(cPropertyType)))
                        {
                            WellPropertyType = ((cPropertyType)(TmpMenuItem).Tag);
                            break;
                        }
                    }
                }

                if ((WellPropertyType != null) && (cGlobalInfo.ViewMode != eViewMode.PIE))
                {
                    Title MainLegend = new Title();

                    string ToDisp = "";

                    if (WellPropertyType != null)
                    {

                        object CurrentValue = TmpWell.ListProperties.FindValueByName(WellPropertyType.Name);
                        if (CurrentValue != null) ToDisp = CurrentValue.ToString();//((double)CurrentValue).ToString("e4");
                        else
                            ToDisp = "n.a.";

                    }

                    New3DWell.AddText(ToDisp, ParentScreening._3DWorldForPlateDisplay, 0.1);
                }

                New3DWell.SetOpacity((double)cGlobalInfo.OptionsWindow.numericUpDownWellOpacity.Value);
                ParentScreening._3DWorldForPlateDisplay.AddBiological3DObject(New3DWell);
                Plate3D.AddObject(New3DWell);
            }

            #endregion

            #region Well numbering
            if (cGlobalInfo.OptionsWindow.checkBox3DPlateInformation.Checked)
            {
                for (int i = 1; i <= ParentScreening.Columns; i++)
                {
                    c3DText CurrentText = new c3DText(ParentScreening._3DWorldForPlateDisplay, i.ToString(), new cPoint3D(i - 1 + MinimumPosition.X, -0.5 + MinimumPosition.Y, 0 + MinimumPosition.Z), Color.White, 0.35);
                    ParentScreening._3DWorldForPlateDisplay.AddGeometric3DObject(CurrentText);
                }
                for (int j = 1; j <= ParentScreening.Rows; j++)
                {
                    c3DText CurrentText1;

                    if (cGlobalInfo.OptionsWindow.radioButtonWellPosModeDouble.Checked)
                        CurrentText1 = new c3DText(ParentScreening._3DWorldForPlateDisplay, j.ToString(), new cPoint3D(-1 + MinimumPosition.X, j - 0.5 + MinimumPosition.Y, 0 + MinimumPosition.Z), Color.White, 0.35);
                    else
                        CurrentText1 = new c3DText(ParentScreening._3DWorldForPlateDisplay, cGlobalInfo.ConvertIntPosToStringPos(j), new cPoint3D(-1 + MinimumPosition.X, j - 0.5 + MinimumPosition.Y, 0 + MinimumPosition.Z), Color.White, 0.35);

                    ParentScreening._3DWorldForPlateDisplay.AddGeometric3DObject(CurrentText1);
                }
            }
            #endregion

            if (this.ListDRCRegions != null)
            {
                foreach (cDRC_Region Region in this.ListDRCRegions)
                {

                    if (cGlobalInfo.OptionsWindow.checkBox1.Checked)
                    {

                        cDRC CurrentDRC = Region.GetDRC(this.ParentScreening.ListDescriptors[IdxDescriptor]);
                        if ((CurrentDRC == null) || (CurrentDRC.ResultFit == null) || (CurrentDRC.ResultFit.Y_Estimated.Count <= 1)) continue;

                        c3DDRC New3DDRC = new c3DDRC(CurrentDRC, Region, Color.White, this.ListMinMax[IdxDescriptor][0], this.ListMinMax[IdxDescriptor][1]);
                        New3DDRC.SetOpacity((double)cGlobalInfo.OptionsWindow.numericUpDownDRCOpacity.Value);
                        //New3DDRC.SetType("[" + TmpWell.GetPosX() + " x " + TmpWell.GetPosY() + "]");
                        ParentScreening._3DWorldForPlateDisplay.AddGeometric3DObject(New3DDRC);
                        //Plate3D.AddObject(New3DDRC);
                    }

                    if (cGlobalInfo.OptionsWindow.checkBox3DComputeThinPlate.Checked)
                    {
                        c3DThinPlate NewThinPlate = new c3DThinPlate(Region, (double)cGlobalInfo.OptionsWindow.numericUpDown3DThinPlateRegularization.Value);

                        if (cGlobalInfo.OptionsWindow.checkBox3DDisplayThinPlate.Checked)
                        {
                            NewThinPlate.SetOpacity(0.5);
                            NewThinPlate.SetToWireFrame();
                            ParentScreening._3DWorldForPlateDisplay.AddGeometric3DObject(NewThinPlate);
                        }
                        if (cGlobalInfo.OptionsWindow.checkBox3DDisplayIsoboles.Checked)
                        {
                            for (double PosZContour = 0; PosZContour <= 10.0; PosZContour += 1.5)
                            {
                                c3DIsoContours NewContour = new c3DIsoContours(NewThinPlate, Region, Color.Red, PosZContour, true);
                                ParentScreening._3DWorldForPlateDisplay.AddBiological3DObject(NewContour);
                            }
                        }
                        if (cGlobalInfo.OptionsWindow.checkBox3DDisplayIsoRatioCurves.Checked)
                        {
                            //   for (double PosZContour = 0; PosZContour <= 15.0; PosZContour += 3)
                            {
                                c3DIsoContours NewContour = new c3DIsoContours(NewThinPlate, Region, Color.Blue, 0/*PosZContour*/, false);
                                ParentScreening._3DWorldForPlateDisplay.AddBiological3DObject(NewContour);
                            }
                        }
                    }
                }
            }
        }