Example #1
0
        public GaussianFilter(int persentage = 100, int offset = 0)
        {
            progressPerc = QM.clamp(persentage, 0, 100);
            progressOffs = QM.clamp(offset, 0, 100 - progressPerc);

            createGaussianKernel(3, 2);
        }
Example #2
0
    //FUNCTION : AssignedQuest
    //DESCRIPTION : Assigns the quest to the player if needed
    void AssignQuest()
    {
        //checking to see if valid

        for (int i = 0; i < QuestList.Count; i++)
        {
            if (!QM.searchCQNList(QuestList[i].QuestName))
            {
                if (QM.searchCQNList(QuestList[i].Prereq1) && QM.searchCQNList(QuestList[i].Prereq2))
                {
                    Quest = QuestList[i];

                    AssignedQuest = true;
                    Quest.Load();
                    Quest.StartText();
                    Quest.isActive = true;
                    QM.AddActiveQuests(Quest);
                    if (questIndicator)
                    {
                        questIndicator.GetComponent <ToggleColor>().SetIconMaterialTaken();
                    }
                    QM.CheckItems();
                    return;
                }
            }
        }
        NoMoreQuest();
    }
Example #3
0
        public SubstractionFilter(QBitmap mask, int persentage = 100, int offset = 0)
        {
            maskImage = mask;

            progressPerc = QM.clamp(persentage, 0, 100);
            progressOffs = QM.clamp(offset, 0, 100 - progressPerc);
        }
Example #4
0
        public int NewUserId(bool isPerson = true)
        {
            int?untn = isPerson ? QM.QueryInteger(Connection, "select untn from v_kadr_fin k where not exists(select null from user_name u where u.untn = k.untn) and k.r_u = 'Работает' and rownum < 2", null) : null;

            var username = RandomString(10);

            using (var fsis = new OracleConnection("Direct=True;User Id = fsis;Password=fs;Host=testfin;SID=B;Port=1521;Pooling=false"))
            {
                fsis.Open();

                var command = new OracleCommand
                {
                    Connection  = fsis,
                    CommandType = System.Data.CommandType.StoredProcedure,
                    CommandText = "create_username"
                };

                command.Parameters.Add("p_username", username);
                command.Parameters.Add("p_untn", untn);

                command.ExecuteNonQuery();

                fsis.Commit();
            }

            Commit();

            return(NUserPack.GetUserId(Connection, username));
        }
Example #5
0
    //FUNCTION : CheckQuest
    //DESCRIPTION : Checking to see if quest is done or not and assigning the correct dialoge/action
    void CheckQuest()
    {
        if (Quest.Completed && !Quest.SecondNPC)
        {
            if (Quest.isPortalSwitch)
            {
                Portal.SwitchPortalStage();
            }

            Quest.GiveReward();
            Helped        = true;
            AssignedQuest = false;
            QM.addToCQNList(Quest.QuestName);
            Quest.CompletedText();
            Quest.isActive = false;
            QM.RemoveActiveQuest(Quest);
        }
        else if (Quest.Completed && Quest.SecondNPC)
        {
            Quest.CompletedText();
        }
        else
        {
            Quest.InprogressText();
        }
    }
Example #6
0
        internal Pasport GetResult()
        {
            int pspId = QM.Nextval(connection, "n_pasport_seq");

            QM.DML(connection, "insert into pasport(pasport_id,nc,npart,nplav,bsh_id, vid_proizv_id,date_zap) values (:0,:1,:2,:3,:4, :5, sysdate)", new object[] { pspId, Nc, NPart, NPlav, BshId, VidProizvId });
            QM.DML(connection, "insert into n_pasport(n_pasport_id,pasport_id) values (:0,:0)", new object[] { pspId });

            if (ShifrId != 0)
            {
                QM.DML(connection, "insert into n_pasport_shifr(n_pasport_id,uslov_shifr_id) values (:0,:1)", new object[] { pspId, ShifrId });
            }



            var psp = new Pasport(connection, pspId);

            for (var i = 0; i < ZagotCount; i++)
            {
                psp.AddZagot($"T{i}");
            }

            psp.LinkTek(TekId);
            psp.GenerateOpers();

            psp.Document.TransTo("22P_EL_PASP");
            psp.Document.Denorm();



            return(psp);
        }
Example #7
0
        protected override Color calculateNewPixelColor(QBitmap sourceImage, int x, int y)
        {
            int ImgsW  = sourceImage.Width;
            int ImgsH  = sourceImage.Height;
            int Radius = 2;

            double _R_ = 0;
            double _G_ = 0;
            double _B_ = 0;

            double Z = 1.0 / Math.Pow(Radius, 4);

            for (int i = QM.clamp(x - Radius, 0, ImgsW); i < QM.clamp(x + Radius, 0, ImgsW); i++)
            {
                double _R = 0;
                double _G = 0;
                double _B = 0;

                for (int j = QM.clamp(y - Radius, 0, ImgsH); j < QM.clamp(y + Radius, 0, ImgsH); j++)
                {
                    (byte R, byte G, byte B) = sourceImage.GetPixel(i, j);

                    _R += R;
                    _G += G;
                    _B += B;
                }

                _R_ += _R * Z;
                _G_ += _G * Z;
                _B_ += _B * Z;
            }

            return(QM.Col(_R_, _G_, _B_));
        }
Example #8
0
        protected override Color calculateNewPixelColor(QBitmap sourceImage, int x, int y)
        {
            int radiusX = kernel.GetLength(0) / 2;
            int radiusY = kernel.GetLength(1) / 2;

            double resultR = 0;
            double resultG = 0;
            double resultB = 0;

            for (int l = -radiusY; l <= radiusY; l++)
            {
                for (int k = -radiusX; k <= radiusX; k++)
                {
                    // Значение по X
                    int idX = QM.clamp(x + k, 0, sourceImage.Width - 1);
                    // Значение по Y
                    int idY = QM.clamp(y + l, 0, sourceImage.Height - 1);

                    // Каналы в точки X,Y
                    (byte R, byte G, byte B) = sourceImage.GetPixel(idX, idY);


                    // kernel[0...radiusX, 0...radiusY]
                    // Двумерная свертка
                    resultR += R * kernel[k + radiusX, l + radiusY];
                    resultG += G * kernel[k + radiusX, l + radiusY];
                    resultB += B * kernel[k + radiusX, l + radiusY];
                }
            }

            return(QM.Col(resultR, resultG, resultB));
        }
Example #9
0
        internal int RandomUntn()
        {
            var max = (int)QM.QueryInteger(Connection, "select max(untn) from v_kadr_fin", new object[0]);

            max = random.Next(max);

            return((int)QM.QueryInteger(Connection, "select max(untn) from v_kadr_fin where untn<:0", new object[] { max }));
        }
Example #10
0
        protected override Color calculateNewPixelColor(QBitmap sourceImage, int x, int y)
        {
            byte k = 15;

            //Получаем значения трех каналов пикселя с координатами (x,y)
            (byte R, byte G, byte B) = sourceImage.GetPixel(x, y);

            return(QM.Col(R + k, G + k, B + k));
        }
Example #11
0
        private int NewPdrId()
        {
            var id = QM.Nextval(Connection, "seq1");

            QM.DML(GRPOConnection,
                   "insert into lns_pdr_vinov(lns_pdr_vinov_id, nc, naim) values(:0,:1,:2)",
                   new object[] { id, "22", RandomString(20) });
            return(id);
        }
Example #12
0
        protected override Color calculateNewPixelColor(QBitmap sourceImage, int x, int y)
        {
            //Получаем значения трех каналов пикселя с координатами (x,y)
            (byte R, byte G, byte B) = sourceImage.GetPixel(x, y);

            R = QM.clamp(R * _R_);
            G = QM.clamp(G * _G_);
            B = QM.clamp(B * _B_);

            return(QM.Col(R, G, B));
        }
Example #13
0
        public void AddZagot(string number)
        {
            var zagotid = QM.Nextval(connection, "seq1");

            QM.DML(connection,
                   "insert into zagot(ZAGOT_ID, PASPORT_ID, ZAG, START_VV_ZAG_STATUS_ID, VV_ZAG_STATUS_ID) values(:0, :1, :2, :3, :3)",
                   new object[] { zagotid, Id, number, ZagotType.PRODUCT }
                   );

            Ed04Pak.CreateDoc(connection, zagotid);
        }
Example #14
0
        public SobelYFilter(int persentage = 100, int offset = 0)
        {
            progressPerc = QM.clamp(persentage, 0, 100);
            progressOffs = QM.clamp(offset, 0, 100 - progressPerc);

            kernel = new float[size, size];

            kernel[0, 0] = -1.0f; kernel[0, 1] = -2.0f; kernel[0, 2] = -1.0f;
            kernel[1, 0] = +0.0f; kernel[1, 1] = +0.0f; kernel[1, 1] = +0.0f;
            kernel[2, 0] = +1.0f; kernel[2, 1] = +2.0f; kernel[2, 2] = +1.0f;
        }
Example #15
0
        protected override Color calculateNewPixelColor(QBitmap sourceImage, int x, int y)
        {
            (byte oR, byte oG, byte oB) = maskImage.GetPixel(QM.clamp(x, 0, maskImage.Width), QM.clamp(y, 0, maskImage.Height));
            (byte pR, byte pG, byte pB) = sourceImage.GetPixel(x, y);

            byte R = QM.clamp(oR - pR);
            byte G = QM.clamp(oG - pG);
            byte B = QM.clamp(oB - pB);

            return(QM.Col(R, G, B));
        }
Example #16
0
        internal Resource NewResource()
        {
            var s          = QM.QueryString(Connection, "select g.id_global from v_global_obor g minus select r.global_id from smz_obor_resource r", null);
            var globalId   = Convert.ToInt64(s);
            var resourceId = SmzResourcePkg.GetOborResourceId(Connection, globalId, null);


            var r = new Resource(GRPOConnection, resourceId)
            {
                PdrId = NewPdrId()
            };

            return(new Resource(Connection, r.Id));
        }
Example #17
0
        protected override Color calculateNewPixelColor(QBitmap sourceImage, int x, int y)
        {
            byte k = 15;

            //Получаем значения трех каналов пикселя с координатами (x,y)
            (byte R, byte G, byte B) = sourceImage.GetPixel(x, y);

            double Intensity = (.299F * R + .587F * G + .113F * B);

            R = QM.clamp(Intensity + k * 2);
            G = QM.clamp(Intensity + k / 2);
            B = QM.clamp(Intensity - k * 1);

            return(QM.Col(R, G, B));
        }
Example #18
0
        internal Tek GetResult()
        {
            var tekId = NTekAppPkg.CreateTek(connection, Nc, Obozn);

            NTekAppPkg.SetWorkTek(connection, tekId);

            QM.Update(connection, "N_TEK", tekId, "NAIM_ID", NaimId);

            var marshid = QM.Insert(connection, "insert into tpp.n_marsh(n_tek_id, spr_oper_id, npp) values (:0, :1, :2)  returning n_marsh_id into :id", new object[] { tekId, SprOperId, 1 });

            var marsh = new Marsh(connection, marshid);

            marsh.AddObor(SprOborId, true);


            return(new Tek(connection, tekId));
        }
Example #19
0
    public override void Interact()
    {
        nameText.SetText(CharacterName);
        isActive = !isActive;
        if (!isSecondaryNPC)
        {
            if (!AssignedQuest && !Helped)
            {
                AssignQuest();
            }
            else if (AssignedQuest && !Helped)
            {
                CheckQuest();
            }
            else
            {
                NextQuest();
            }
        }
        else if (isSecondaryNPC)
        {
            if (!Quest.Completed)
            {
                Quest.SNPCInprogressText();
                Cleared();
            }
            else if (Quest.Completed)
            {
                if (Quest.isPortalSwitch)
                {
                    Portal.SwitchPortalStage();
                }

                Quest.ChangeHasQuests();
                Quest.SecondNPCCompletedText();
                Quest.GiveReward();
                QM.addToCQNList(Quest.QuestName);
                Quest.isActive = false;
                QM.RemoveActiveQuest(Quest);
                isSecondaryNPC = false;
                Helped         = true;
                AssignedQuest  = false;
            }
        }
    }
Example #20
0
        public BlurFilter(int persentage = 100, int offset = 0)
        {
            progressPerc = QM.clamp(persentage, 0, 100);
            progressOffs = QM.clamp(offset, 0, 100 - progressPerc);

            int sizeX = 3;
            int sizeY = 3;

            kernel = new float[sizeX, sizeY];

            for (int i = 0; i < sizeX; i++)
            {
                for (int j = 0; j < sizeY; j++)
                {
                    kernel[i, j] = 1.0f / (float)(sizeX * sizeY);
                }
            }
        }
Example #21
0
        public void Insert()
        {
            var cmd1 = new OracleCommand($"drop table {TABLE_NAME}", A.GRPOConnection);
            var cmd2 = new OracleCommand($"create table {TABLE_NAME} ({INT_1} int) ", A.GRPOConnection);

            try { cmd1.ExecuteNonQuery(); }
            catch (OracleException e) { if (e.Code != 942)
                                        {
                                            throw;
                                        }
            }

            cmd2.ExecuteNonQuery();

            QM.Insert(A.GRPOConnection, $"insert into {TABLE_NAME} ({INT_1}) values (1)", new object[0]);

            Assert.AreEqual(1, new Table(TABLE_NAME).Count(A.GRPOConnection));
        }
Example #22
0
        internal void AddPermission(string username, Permission permission)
        {
            var roleName = GetRoleName(permission);

            var roleId = QM.QueryInteger(connection, "select agr_role_id from agr_role where agr_role=:0", roleName);

            if (roleId == null)
            {
                throw new Exception($"role not found {roleName}");
            }

            var userId = NUserPack.GetUserId(connection, username.ToUpper());

            if (AgrAppPkg.UserHasRole(connection, userId, (int)roleId))
            {
                return;
            }

            AgrCorePkg.GrantRoleToUser(connection, (int)roleId, userId, true);
        }
Example #23
0
        protected override Color calculateNewPixelColor(QBitmap sourceImage, int x, int y)
        {
            int MaskW = Mask.SizeX;
            int MaskH = Mask.SizeY;

            byte maxR = 0;
            byte maxG = 0;
            byte maxB = 0;

            int MWHalf = MaskW / 2;
            int MHHalf = MaskH / 2;

            for (int j = -MHHalf; j <= MHHalf; j++)
            {
                for (int i = -MWHalf; i <= MWHalf; i++)
                {
                    (byte R, byte G, byte B) = sourceImage.GetPixel(x + i, y + j);

                    if ((Mask.map[MWHalf + i, MHHalf + j]) && (R > maxR))
                    {
                        maxR = R;
                    }

                    if ((Mask.map[MWHalf + i, MHHalf + j]) && (G > maxG))
                    {
                        maxG = G;
                    }

                    if ((Mask.map[MWHalf + i, MHHalf + j]) && (B > maxB))
                    {
                        maxB = B;
                    }
                }
            }

            return(QM.Col(maxR, maxG, maxB));
        }
Example #24
0
        protected override Color calculateNewPixelColor(QBitmap sourceImage, int x, int y)
        {
            int MaskW = Mask.SizeX;
            int MaskH = Mask.SizeY;

            byte minR = 255;
            byte minG = 255;
            byte minB = 255;

            int MWHalf = MaskW / 2;
            int MHHalf = MaskH / 2;

            for (int j = -MHHalf; j <= MHHalf; j++)
            {
                for (int i = -MWHalf; i <= MWHalf; i++)
                {
                    (byte R, byte G, byte B) = sourceImage.GetPixel(x + i, y + j);

                    if ((Mask.map[i + MWHalf, j + MHHalf]) && (R < minR))
                    {
                        minR = R;
                    }

                    if ((Mask.map[i + MWHalf, j + MHHalf]) && (G < minG))
                    {
                        minG = G;
                    }

                    if ((Mask.map[i + MWHalf, j + MHHalf]) && (B < minB))
                    {
                        minB = B;
                    }
                }
            }

            return(QM.Col(minR, minG, minB));
        }
Example #25
0
 public void SetPixel(int x, int y, double ch)
 {
     SetPixel(x, y, QM.clamp(ch));
 }
Example #26
0
 protected override Color calculateNewPixelColor(QBitmap sourceImage, int x, int y)
 {
     (byte R, byte G, byte B) = sourceImage.GetPixel(x, y);  //Получаем значения трех каналов пикселя с координатами (x,y)
     return(QM.Col(.299F * R + .587F * G + .113F * B));      //Вычисляем значение трех каналов для градации серого
 }
Example #27
0
 public TopHat(int persentage = 100, int offset = 0)
 {
     progressPerc = QM.clamp(persentage, 0, 100);
     progressOffs = QM.clamp(offset, 0, 100 - progressPerc);
 }
Example #28
0
 //переопред функцию
 protected override Color calculateNewPixelColor(QBitmap sourceImage, int x, int y)
 {
     (byte R, byte G, byte B) = sourceImage.GetPixel(x, y); //Получаем каналы цвет исходного пикселя
     return(QM.Col(255 - R, 255 - G, 255 - B));             //Вычисляем инверсию цвета
 }
Example #29
0
 public SobelFilter(int persentage = 100)
 {
     progressPerc = QM.clamp(persentage, 0, 100);
 }
Example #30
0
 public MedianaFilter(int persentage = 100, int offset = 0)
 {
     progressPerc = QM.clamp(persentage, 0, 100);
     progressOffs = QM.clamp(offset, 0, 100 - progressPerc);
 }