Пример #1
0
        /// <summary>
        /// Paint a line given the 2 points
        /// </summary>
        /// <param name="points"></param>
        private void makeLine(LinkedList <Pair <double, double> > points)
        {
            NWN2Toolset.NWN2.Views.NWN2AreaViewer viewer   = getAreaViewer();
            NWN2Toolset.NWN2ToolsetMainForm       mainForm = NWN2Toolset.NWN2ToolsetMainForm.App;
            NWN2GameArea area = viewer.Area;

            TRN trn = new SFX.YATT.DAL.TRN(new System.IO.BinaryReader(area.TerrainResource.GetStream(false)), area.Name);

            Pair <Pair <double, double>, Pair <double, double> > resultPair = findUpperAndLower(points);

            Pair <double, double> upper = resultPair.X;
            Pair <double, double> lower = resultPair.Y;

            trn = ApplyLine(area, trn, upper, lower);

            System.IO.Stream       stream = area.TerrainResource.GetStream(true);
            System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream);

            trn.Save(writer);
            stream.Flush();
            stream.Close();
            areaViewer.SaveContents(true, OEIShared.UI.OEIMessageBoxResult.OK);
            mainForm.WaitForPanelsToSave();

            mainForm.CloseViewer(areaViewer, true);
        }
Пример #2
0
        private void paintTriangles(LinkedList <Triangle> triangles)
        {
            NWN2Toolset.NWN2.Views.NWN2AreaViewer viewer = getAreaViewer();
            if (viewer != null)
            {
                NWN2Toolset.NWN2ToolsetMainForm mainForm = NWN2Toolset.NWN2ToolsetMainForm.App;
                NWN2GameArea area = viewer.Area;
                TRN          trn  = new SFX.YATT.DAL.TRN(new System.IO.BinaryReader(area.TerrainResource.GetStream(false)), area.Name);

                // The random object we are going to use for all the instances
                Random ran = new Random();

                area.Demand();
                area.RefreshTerrainResource();

                System.IO.Stream       stream = area.TerrainResource.GetStream(true);
                System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream);

                foreach (Triangle triangle in triangles)
                {
                    trn = ApplyTriangle(area, trn, triangle, triangle.getUpper(), triangle.getLower(), ran);
                }

                trn.Save(writer);
                stream.Flush();
                stream.Close();

                viewer.SaveContents(true, OEIShared.UI.OEIMessageBoxResult.OK);

                mainForm.WaitForPanelsToSave();
                mainForm.CloseViewer(viewer, true);
            }
        }
Пример #3
0
        private void paintTriangles(LinkedList<Triangle> triangles)
        {
            NWN2Toolset.NWN2.Views.NWN2AreaViewer viewer = getAreaViewer();
            if (viewer != null) {
                NWN2Toolset.NWN2ToolsetMainForm mainForm = NWN2Toolset.NWN2ToolsetMainForm.App;
                NWN2GameArea area = viewer.Area;
                TRN trn = new SFX.YATT.DAL.TRN( new System.IO.BinaryReader( area.TerrainResource.GetStream( false ) ), area.Name );

                // The random object we are going to use for all the instances
                Random ran = new Random();

                area.Demand();
                area.RefreshTerrainResource();

                System.IO.Stream stream = area.TerrainResource.GetStream( true );
                System.IO.BinaryWriter writer = new System.IO.BinaryWriter( stream );

                foreach (Triangle triangle in triangles) {
                    trn = ApplyTriangle(area, trn, triangle, triangle.getUpper(), triangle.getLower(), ran);
                }

                trn.Save(writer);
                stream.Flush();
                stream.Close();

                viewer.SaveContents(true, OEIShared.UI.OEIMessageBoxResult.OK);

                mainForm.WaitForPanelsToSave();
                mainForm.CloseViewer(viewer, true);
            }
        }
Пример #4
0
        /// <summary>
        /// Paint a line given the 2 points
        /// </summary>
        /// <param name="points"></param>
        private void makeLine(LinkedList<Pair<double, double>> points)
        {
            NWN2Toolset.NWN2.Views.NWN2AreaViewer viewer = getAreaViewer();
            NWN2Toolset.NWN2ToolsetMainForm mainForm = NWN2Toolset.NWN2ToolsetMainForm.App;
            NWN2GameArea area = viewer.Area;

            TRN trn = new SFX.YATT.DAL.TRN( new System.IO.BinaryReader( area.TerrainResource.GetStream( false ) ), area.Name );

            Pair<Pair<double, double>, Pair<double, double>> resultPair = findUpperAndLower(points);

            Pair<double, double> upper = resultPair.X;
            Pair<double, double> lower = resultPair.Y;

            trn = ApplyLine(area, trn, upper, lower);

            System.IO.Stream stream = area.TerrainResource.GetStream( true );
            System.IO.BinaryWriter writer = new System.IO.BinaryWriter( stream );

            trn.Save( writer );
            stream.Flush();
            stream.Close();
            areaViewer.SaveContents(true, OEIShared.UI.OEIMessageBoxResult.OK);
            mainForm.WaitForPanelsToSave();

            mainForm.CloseViewer(areaViewer, true);
        }