예제 #1
0
        private static void Test(int minData, int maxData, int minProxy, int maxProxy)
        {
            LogarithmicMapper mapper = new LogarithmicMapper(minData, maxData, minProxy, maxProxy);

            int m1 = mapper.Map(minData);
            int m2 = mapper.Map(maxData);
            int u1 = mapper.Unmap(minProxy);
            int u2 = mapper.Unmap(maxProxy);

            log.Debug("----------------------------------------");
            log.DebugFormat("data:[{0}..{1}], proxy:[{2}..{3}]", minData, maxData, minProxy, maxProxy);
            log.DebugFormat("data:{0}, proxy:{1}", minData, m1);
            log.DebugFormat("data:{0}, proxy:{1}", maxData, m2);
            log.DebugFormat("proxy:{0}, data:{1}", minProxy, u1);
            log.DebugFormat("proxy:{0}, data:{1}", maxProxy, u2);

            /*
             * //int m3 = mapper.Map((maxData - minData) / 2);
             * //int u3 = mapper.Unmap((maxProxy - minProxy) / 2);
             *
             * int m4 = mapper.Map(0);
             * int m5 = mapper.Map(1001);
             * int u4 = mapper.Unmap(0);
             * int u5 = mapper.Unmap(11);*/
        }
        private void tbValue_ValueChanged(object sender, EventArgs e)
        {
            if (updatingValue)
            {
                return;
            }

            int value = logMapper.Unmap(tbValue.Value);

            property.CurrentValue = value.ToString(CultureInfo.InvariantCulture);
            lblValue.Text         = valueMapper(value);

            property.Automatic = false;

            updatingValue  = true;
            cbAuto.Checked = property.Automatic;
            updatingValue  = false;

            RaiseValueChanged();
        }